Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbPress and Yoast SEO conflict – How to change the meta title for the replies?

Viewing 25 replies - 1 through 25 (of 36 total)

  • Robin W
    Moderator

    @robin-w

    I don’t know if this fixes?

    BBpress Addon For Yoast SEO

    if it does come back and tell us


    amirzwp
    Participant

    @amirzwp

    Thanks for your answer. This only does that the topics in BBpress displays the correct meta description from Topic Content. But I need it also for the Reply-Pages, like I mentioned.


    Robin W
    Moderator

    @robin-w

    thanks – I’m just a user who helps out here, not a bbpress author.

    so

    1. can you confirm that the above plugin is not necessary – bbpress already does this ?

    2.

    can you try this code

    add_filter( 'wpseo_metadesc', 'rew_meta_desc' );
    function rew_meta_desc( $content ) {
        global $post;
        if ($post->post_type == 'reply' ) {
    		$order = $post->menu_order ;
    		$post_parent = $post->post_parent ;
    		$title = get_the_title ($post_parent) ;
            $content = $title.' '.$order ;
        }
     return $content;
    }

    Put this in your child theme’s function file – or use

    Code Snippets


    amirzwp
    Participant

    @amirzwp

    Thank you very much for your response.

    This only changes the Meta Description, right? Is there an option, to also change the Meta Title (And like I said, it should be unique, so we can avoid duplicate titles)

    Thank you very much!


    Robin W
    Moderator

    @robin-w

    ah, I understand, sorry not really into SEO

    try this

    add_filter( 'wpseo_metatitle', 'rew_meta_title' );
    function rew_meta_title( $title ) {
        global $post;
        if ($post->post_type == 'reply' ) {
    		$order = $post->menu_order ;
    		$post_parent = $post->post_parent ;
    		$topic_title = get_the_title ($post_parent) ;
            $title = $topic_title.' '.$order ;
        }
     return $title;
    }

    amirzwp
    Participant

    @amirzwp

    And again, thank you very much for your help.

    It didn’t change anything on the BBPRESS – Reply Pages, for example:

    https://www.paastoa.com/antworten/8907/

    Is the code you sent me really for BBPRESS? I think it’s for the normal replies…


    Robin W
    Moderator

    @robin-w

    post type reply is definately bbpress.

    so how would I know from the link whether it is working – what am I looking for ?


    Robin W
    Moderator

    @robin-w

    I don’t have any sites with both yoast and forums on them (my forum sites are profession related sites with private forums so don’t want to advertise!).

    So I don’t know which part of the code is faulty.

    If you are able to test, then start with

    add_filter( 'wpseo_metatitle', 'rew_meta_title' );
    function rew_meta_title( $title ) {
           if ($post->post_type == 'reply' ) {
    	 $title = 'this is a reply' ;
        }
     return $title;
    }

    this should make the title of each reply ‘this is a reply’

    if that works, then we kwow the function is working, but not getting the right answer !

    If it doesn’t work, then I’ll come back with another


    amirzwp
    Participant

    @amirzwp

    Changed it, but it doesn’t appear on the website: https://www.paastoa.com/antworten/8907/

    Thx for your help


    Robin W
    Moderator

    @robin-w

    ok, can I ask again

    so how would I know from the link whether it is working – what am I looking for ?


    amirzwp
    Participant

    @amirzwp

    You can check the Title in the Browser-Tab. Currently, it’s showing the following text:

    | Paastoa

    So it’s only the seperator and the website title…

    Also when you open the source code of the page, it shows:

    <title>| Paastoa</title>

    URL: https://www.paastoa.com/antworten/8907/

    Thanks for your help.


    Robin W
    Moderator

    @robin-w

    thanks – just to ask the obvious, you are running the yoast plugin ?? 🙂

    then as a test can you try a correction to my previous code

    add_filter( 'wpseo_metatitle', 'rew_meta_title' );
    function rew_meta_title( $title ) {
    global $post ;
           if ($post->post_type == 'reply' ) {
    	 $title = 'this is a reply' ;
        }
     return $title;
    }

    if that fails, can you try (as a test only)

    add_filter( 'wpseo_metatitle', 'rew_meta_title' );
    function rew_meta_title( $title ) {
     $title = 'this is a reply' ;
       return $title;
    }

    This should put that phase at the top of every pages, and will at least show that the filter is working.


    amirzwp
    Participant

    @amirzwp

    sure, yoast SEO (Also Premium version) is enabled.

    I tried both of the codes you sent me, both doesn’t have an effect on the Meta Title.

    The snippet with the following code is still activated on the website:

    add_filter( 'wpseo_metatitle', 'rew_meta_title' );
    function rew_meta_title( $title ) {
    global $post ;
           if ($post->post_type == 'reply' ) {
    	 $title = 'this is a reply' ;
        }
     return $title;
    }

    So you can check, if there happend something. I deleted the other snippet because it also didn’t had an effect on the website. But when it has an effect, it’s not so good because the website is live.

    Thanks for your time.


    Robin W
    Moderator

    @robin-w

    thanks, ok lets try this

    add_filter( 'wpseo_title', 'rew_meta_title' );
    function rew_meta_title( $title ) {
    global $post ;
           if ($post->post_type == 'reply' ) {
    	 $title = 'this is a reply' ;
        }
     return $title;
    }

    amirzwp
    Participant

    @amirzwp

    That makes, that the page disappears: https://www.paastoa.com/antworten/8907/

    :’D


    Robin W
    Moderator

    @robin-w

    ok, so not the way to go.

    Let me have a think


    amirzwp
    Participant

    @amirzwp

    I think your code did something really bad, it redirects my forums now to other pages… what can I do?

    For example: https://www.paastoa.com/forum/intervallfasten/


    Robin W
    Moderator

    @robin-w

    just remove the code

    and refresh your browser


    amirzwp
    Participant

    @amirzwp

    Done, still can’t see the page: https://www.paastoa.com/antworten/8907/
    And the forum itself redirects: https://www.paastoa.com/forum/intervallfasten/
    Can you access it?


    Robin W
    Moderator

    @robin-w

    ok, suggest you go into these in the backend and resave them


    amirzwp
    Participant

    @amirzwp

    Do you have an idea how and where?


    amirzwp
    Participant

    @amirzwp

    Ok I fixed it with deactivating and activating bbpress again.


    Robin W
    Moderator

    @robin-w

    great


    defiance12
    Participant

    @defiance12

    this works however the meta title needs to include the post title also e.g.

    Reply To: %forum post title%

    What code is needed to add this?

    Thanks!


    defiance12
    Participant

    @defiance12

Viewing 25 replies - 1 through 25 (of 36 total)
  • You must be logged in to reply to this topic.
Skip to toolbar