*

Buzz List UK

  • **
  • 21 posts
Canonical URL search page
« on: February 23, 2026, 04:00:23 PM »
Hi. I have search page Anunciospty.com
If select city , canonical redirect to default search page. Any solutions ?
anunciospty.com/buscar
Anunciospty.com/buscar/city_122example , canonical tag point to another page - default search page. Tks

Marked as best answer by frosticek on February 24, 2026, 03:59:26 PM
*

MB Themes

Re: Canonical URL search page
« Reply #1 on: February 24, 2026, 09:26:19 AM »
In osclass core functions.php find
Code: [Select]
function osc_generate_canonical() {
  if(osc_always_generate_canonical_enabled()) {
    $url = osc_apply_filter('canonical_url', osc_get_current_url());
    View::newInstance()->_exportVariableToView('canonical', $url);
  }
}

Replace with:
Code: [Select]
function osc_generate_canonical() {
  if(osc_always_generate_canonical_enabled() && !osc_is_search_page()) {
    $url = osc_apply_filter('canonical_url', osc_get_current_url());
    View::newInstance()->_exportVariableToView('canonical', $url);
  }
}

basically it's overwritten that's the reason.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Buzz List UK

  • **
  • 21 posts
Re: Canonical URL search page
« Reply #2 on: February 24, 2026, 11:30:14 AM »
I have this :
// Generate canonical URL on all pages
function osc_generate_canonical() {
  if(osc_always_generate_canonical_enabled()) {
    $url = osc_apply_filter('canonical_url', osc_get_current_url());
    View::newInstance()->_exportVariableToView('canonical', $url);
  }
}

osc_add_hook('init', 'osc_generate_canonical', 1);

*

Buzz List UK

  • **
  • 21 posts
Re: Canonical URL search page
« Reply #3 on: February 24, 2026, 11:31:38 AM »
done. tks.

*

canis

  • *
  • 1 posts
Re: Canonical URL search page
« Reply #4 on: March 30, 2026, 03:00:17 PM »
It is better to modify the functions.php file using a child theme to prevent losing changes when the theme is updated in the future.  :D

*

MB Themes

Re: Canonical URL search page
« Reply #5 on: March 30, 2026, 04:49:42 PM »
Mostly yes.
But even best is to create elemental plugin with just index.php that does not exists where you can put your custom functions
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots