Problem with Power Words combined with class / span

#30105
  • Resolved Ralf Reymann
    Rank Math pro

    First i added this in my functions php to include german own power words:

    add_filter( 'rank_math/metabox/power_words', function( $words ){
    $words[] = 'o2';
    return $words;
    });
    

    In this case the Brand is a Power Word for me.

    After this i use also “Span” in Headline to get part of it in color:

    <span class=”farbig”>o2 Free S Boost</span> – 24,99 €

    null

    The title is correct transformed by Rank math:

    null

    But Power Words shows red:

    null

    When I do a space before, it works – but a space at the first part auf Headline makes no sense. Can you check, that power word is noticed even with a > infront?

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

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

    It looks like you are passing a string to the expected array. It is recommended to make use of the array_merge() function to append the newly added power words to the words array as shown below:

    add_filter( 'rank_math/metabox/power_words', function( $words ){
    	$new_words = [
    		'o2'
    	];
    	return array_merge( $words, $new_words );
    });

    Looking forward to helping you. Thank you.

    ​​​​​​​

    I changed the functions php already:

    null

    But the problem is the same.

    There is a additional bug in new BETA version (1.0.37.3-beta). The “span” part now is also shown in the headline preview of rank math:

    null

    This problem was not in the version before, as you can see in the screenshot of my first post to this topic.

    Code is correct, just preview of rank math is wrong:

    null

    Hello,

    Thank you for contacting Rank Math today.

    I have just raised both problems with our dev team and you can expect a response after a short while.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Todd
    Rank Math free

    Hello Ralf,

    Thank you for your patience.

    HTML tags do not work in the <title> and that is why they are stripped.

    I assume you want to add them because you have seen search results showing some terms in bold? That is because Google automatically bolds keywords that are related to the search made by the visitors. If you check any page’s source code, you will note that neither <title> nor <meta description="" show HTML tags.

    So, your best bet is to not use HTML in the title and meta description.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Thats the point. I dont want to use it in titel and description. But I want to use it for H1 (Main title for Post or Page). And this works fine in layout auf my page.

    And in title from Rank Math i have %title” in to let Rank math use H1 Title from WordPress. And so Rank Math should remove / convert the title without html tag.

    Old version did it (see first message of this ticket) – but there was the problem that the power word was not find. New version did not convert and html tag is in the title now.

    Todd
    Rank Math free

    Hi Ralf,

    I see your point.

    This is only happening in the Classic Editor. We tested it in the Block Editor and it works work and Rank Math strips the HTML tag:
    null

    For now, please click on the SEO title shown by Rank Math and manually change it to text only. That will do the trick and fix the issue you are facing.

    In the meantime, we are also noting it for enhancement and will fix this in an upcoming update.

    ok, thank you 🙂

    Todd
    Rank Math free

    Hi Ralf,

    I am so glad to be of help. We are always here if you need us in the future.

    Hey, if it isn’t too much to ask for – would you mind leaving us a review here?

    https://s.rankmath.com/reviewrm

    It only takes a couple of minutes but helps us tremendously.

    It would mean so much to us.

    Thank you.

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

The ticket ‘Problem with Power Words combined with class / span’ is closed to new replies.