Tag %name% does not work in titles & meta for BBpress user profile page

#21795
  • Resolved Bogdan Cristescu
    Rank Math free

    Hi there,
    I just came here with a strange issue that I think does not affect many people as not many still use bbpress. We have a nice forum and some users there. We have also authors, on the blog section of the website. How to say it, on Rank Math I did not even have the Author section for BBpress in Titles & Meta.

    Please, I wish just the tag %name% used in the title and description to get the name of the user, to work also for BBpress profile page.

Viewing 1 replies (of 1 total)
  • Michael Davis
    Rank Math pro

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    This variable will not work on bbPress user profiles because these pages store user data in a different variable $bb_current_user. You can workaround this in two ways:
    1). You can register a custom replacement variable for these pages using the following filter:

    /**
     * Filter to add custom variables
     */
    add_filter( 'rank_math/vars/replacements', function( $vars ) {
     return $vars;
    });

    2). You can create custom titles/descriptions targeting the profile pages by using the following filters and some custom code to get the user id from bbPress:

    /**
     * Filter to change the page title.
     * 
     * @param string $title
     */
    add_filter( 'rank_math/frontend/title', function( $title ) {
    	return $title;
    });
    
    /**
     * Allow changing the meta description sentence from within the theme.
     *
     * @param string $description The description sentence.
     */
    add_filter( 'rank_math/frontend/description', function( $description ) {
    	return $description;
    });
    

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Tag %name% does not work in titles & meta for BBpress user profile page’ is closed to new replies.