toggle menu

How can i override SEO Ultimate plugin file with custom code if we need to change particular Meta Title for few tags or taxonomy

Manish Singh |23 Mar at 01:03

I have facing a problem with title tag rewrite due to SEO Ultimate Plugin function, if will customize function in SEO plugin then it's loss when i update plugin.

if anyone have solution for it please share with me

thanks in advance

  • 1 like
  • 1 comment

Dhananjay Kumar23 Mar at 02:03

I have a solution for you, Please use the below code above the <title> tag in header.php
$uri=explode("/",$_SERVER['REQUEST_URI']);
$slug=$uri[2];
$taxonomy_names = get_term_by('slug',$slug,'taxonomy name');
$term_meta = get_term_meta( $taxonomy_names->term_id );
global $titlereplacemeta;
$titlereplacemeta=$term_meta[custom field name][0];

$fpath=$_SERVER['DOCUMENT_ROOT']."/wp-content/plugins/seo-ultimate/modules/titles/titles.php";

if(is_file($fpath)){
$str=file_get_contents($fpath);
if(!strstr($str,'global $titlereplacemeta')){
$to='$title = $this->get_title();';
$rplto='global $titlereplacemeta;if($titlereplacemeta!=""){ $title = $titlereplacemeta; }else{ $title = $this->get_title();}';
$str=str_replace($to, $rplto,$str);
file_put_contents($fpath, $str);
}
}
?>

Posted:

23 Mar at 01:03

Viewed:

1124 times

Active:

26 Mar at 03:03