Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1331674

    Hi there,

    I need to let me SEO tool (AIO SEO) handle all titles. Unfortunately your suggested way doesn´t work. I also contacted their support in order to make sure I get the right return function but also not luck.

    Any ideas? I tried:

    add_filter(‘avf_title_tag’, ‘avia_change_title_tag’, 10, 2);
    function avia_change_title_tag( $title, $wptitle )
    {
    return wp_get_document_title();
    }

    As well as:

    add_filter(‘avf_title_tag’, ‘avia_change_title_tag’, 10, 2);
    function avia_change_title_tag( $title, $wptitle )
    {
    return $wptitle;
    }

    • This topic was modified 2 years, 11 months ago by El.
    #1331677

    Also tried:

    remove_filter(‘avf_title_tag’, ‘avia_wpseo_change_title_adjustment’, 10, 2);

    #1332264

    Hi,

    Thank you for the inquiry.

    We have checked the plugin documentation but we cannot find any reference about how it generates the page or post title and how to retrieve it. And we are not sure if the plugin is also using a filter to override the default title.

    Please ask the plugin authors how the plugin generate the title and if there is a way to retrieve that value. There should be a function that we could use in combination with the avf_title_tag filter.

    Best regards,
    Ismael

    #1332289

    Here is their response and suggestion. Enfold doesn´t really take it into account though:

    Thanks for reaching out.

    We filter the core WP Title tag function to manage the Page Title of your page, so you’ll just need to return that in your filter.

    add_filter(‘avf_title_tag’, ‘avia_change_title_tag’, 10, 2);
    function avia_change_title_tag( $title, $wptitle )
    {
    return wp_get_document_title();
    }

    #1332681

    Hi,

    Thank you for the info.

    What happens when you override the avia_set_title_tag function by declaring it again?

    
        function avia_set_title_tag()
        {
            return wp_get_document_title();
        }
    

    If this is not working, then the function wp_get_document_title is not the function that the plugin is using to retrieve the title.

    Best regards,
    Ismael

    #1332774

    Strange. All of these actions produce no change – are you sure these are actually working with the latest enfold?

    remove_filter(‘avf_title_tag’, ‘avia_wpseo_change_title_adjustment’, 10, 2); // no worky

    add_filter(‘avf_title_tag’,’avia_new_title’);
    function avia_new_title() {
    $title = “X: “.get_the_title();
    return $title;
    }

    add_filter(‘avf_title_tag’, ‘avia_change_title_tag’, 10, 2);
    function avia_change_title_tag($title, $wptitle)
    {
    return “X: “.$wptitle;
    }

    function avia_set_title_tag()
    {
    return “X: “.wp_get_document_title();
    }

    function avia_set_title_tag()
    {
    return wp_get_document_title();
    }

    #1332889

    Hi,

    Do you remove the cache and disable the compression after adjusting the code? Declaring the avia_set_title_tag should override the default function and return the value specified, so if you do this for example..

    function avia_set_title_tag()
    {
        return "ECHO";
    }
    

    .. all page title should be set to “ECHO”. You can also disable the default title tag by adding this code.

    remove_action( 'wp_head', 'av_theme_slug_render_title' );
    

    Or this..

    add_action("init", function() {
        remove_action( 'wp_head', 'av_theme_slug_render_title' );
    }, 10);
    

    You can then display your own title tag.

    function av_theme_slug_render_title_mod()
    {
        echo '<title>' . wp_get_document_title() . '</title>';
    }
    add_action( 'wp_head', 'av_theme_slug_render_title_mod' );
    

    Or..

    function av_theme_slug_render_title_mod()
    {
        echo '<title>' . get_the_title(get_the_ID()) . '</title>';
    }
    add_action( 'wp_head', 'av_theme_slug_render_title_mod' );
    

    Unfortunately, we cannot find any reference about how to retrieve the page or post title value set in the AIOSEO settings.

    Best regards,
    Ismael

    #1332947

    Ismael,

    There must be some other issue I cannot trace. All these changes have no effect on the Title.

    
    remove_action('wp_head', 'av_theme_slug_render_title');
    remove_filter('avf_title_tag', 'avia_wpseo_change_title_adjustment');
    
    add_action('init', function() {
        remove_action('wp_head', 'av_theme_slug_render_title');
    	remove_filter('avf_title_tag', 'avia_wpseo_change_title_adjustment');
    }, 10);
    
    function av_theme_slug_render_title_mod()
    {
        echo '<title>X ' . wp_get_document_title() . '</title>';
    }
    add_action( 'wp_head', 'av_theme_slug_render_title_mod' );
    

    I assume you have validated this in a clean enfold install? It does not seem to work for me. I can also not trace any another plugin setting these titles. I also haven´t overwritten those templates in our child theme.

    Best,
    El

    #1333065

    Hi,

    Thank you for following up.

    It actually works fine on our end even without the modifications above.

    back: https://imgur.com/TD9eE4W
    front: https://imgur.com/5CXwJuz

    There is probably another plugin in your installation that overrides the default title.

    Best regards,
    Ismael

    #1333085

    Ismael,

    thank you. I will investigate. It might be due to us being forced to use an older version until AIOSEO adds API support back into their current version. Thanks for testing!

    Best
    Elmar

    #1333486

    Hi,

    No problem. Please feel free to open another thread if you need anything else. We will close this one for now.

    Have a nice day.

    Best regards,
    Ismael

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Overwriting Meta Title fails’ is closed to new replies.