Single Product Title Post Author

  • Hello RankMath,

    The Single Product Title tag %name% is returning the post title instead of the author name.
    null

    I can confirm that the author is correctly set. Firstly, the %userid% tag correctly returns the author id. Secondly, you can view the product on the site here, where we have used function get_the_author() to display the author name.

    I would like to stress what we are seeking is the author display name and not the nicename referenced in your tooltip. Apparently , nicename is a slug form of the name and would not fit in a title description. Also, some often confuse nicename and nickname, but the sensible solution is neither of the aforementioned, but the display name as already stated.

    Should the nicename be appropriate elsewhere, then maybe a new tag of %author% or some such is needed?

    Thank you,
    Barry

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello Again,

    Don’t know what happened to the first screenshot, but here it is again.

    A preview of a ticket before posting would be helpful.

    Thank you,
    Barry

    Hello,

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

    Please note that this variable is designed to work for single posts and not product pages. I can suggest that you create a custom title or description of the product pages by making use of the following filters:

    /**
     * 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.

    ​​​​​​​

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this ticket.