• Resolved Elton Heta

    (@eltonheta)


    Hello, I wanted to know if it is possible to condition the variable “Title” in the number of characters, so that when the variable “Title” is called automatically in a post, it will only receive 60 characters from the title of the post and therefore receive as much as we condition.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello @eltonheta

    Thanks for using the Yoast SEO plugin. It’s not possible to truncate the value of the %%title%% snippet variable at 60 characters, consequently affecting what’s being pulled from the post title

    • This reply was modified 10 months, 2 weeks ago by Maybellyne.
    Thread Starter Elton Heta

    (@eltonheta)

    function limit_title_yoast( $str ) {
     return substr($str, 0, 65); //Replace number 65 with your desired character
    }
    add_filter( 'wpseo_title', 'limit_title_yoast' );
    

    This piece of code used to work for what I’m looking for, now it doesn’t because something may have changed in your coding but I think it can be done with additional pieces of code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Limit the amount of characters in the title variable.’ is closed to new replies.