• Resolved ext103

    (@ext103)


    i have come across a bug in one of my plugins

    https://www.wpultimateplugin.com

    the problem i have is that when a user opts to use the title rewrite setting the rss feed title all become the blog title??

    the way the plugin rewrites the title is like this:

    if($options['title_rewrite'] == 'Enabled'){
       add_action('template_redirect', __NAMESPACE__.'\before_header', 0);
       add_action('wp_head', __NAMESPACE__.'\after_header', 1000);
    function before_header()
       {ob_start(__NAMESPACE__.'\change_title_tag');}
    function after_header()
       {ob_end_flush();}
    function change_title_tag($head) {
       //Replace the old title with the new and return
       return preg_replace('#<title>[^<]*</title>#', '<title>'.seo_title().'</title>', $head);}}

    so i access the head element from the page and format the title using another function seo_title()

    the new function has a !is_feed() check but id doesnt seem to be working??

    is this variable even available before the template_redirect() as i think this is the issue.

Viewing 1 replies (of 1 total)
  • Thread Starter ext103

    (@ext103)

    okay, should of waited a bit, ive found a fix.

    adding the is_feed() call INSIDE the seo_title() function got it to work.

    im still sure this is because i was calling the variable before wordpress loads, but now its fixed, hope this helps others.

Viewing 1 replies (of 1 total)
  • The topic ‘is_feed() before template_redirect()?????’ is closed to new replies.