Disable Table Of Content?

#14267
  • Resolved BodyGuard
    Rank Math free

    Is there a way to disable the plugin from taking “Use Table of Content to break-down your text.” into account? As well as “Your SEO title doesn’t contain a number. “?????

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

    Thank you for contacting Rank Math and sorry for the delay in getting back to you.

    You can add the following code to your theme’s functions.php file to disable these tests:

    /**
     * Rank Math snippet to disable 'titleHasNumber' & 'contentHasTOC' tests.
     *
     * @param array  $tests Array of tests with score
     * @param string $type  Object type. Can be post, user or term.
     */
    add_filter( 'rank_math/researches/tests', function( $tests, $type ) {
    	unset($tests['title-readability']['titleHasNumber']);
    	unset($tests['content-readability']['contentHasTOC']);
        return $tests;
    }, 10, 2 );

    Looking forward to helping you. Thank you.

    ​​​​​​

    Thank you. This does seem to be working. However, it does not seem to affect the score in a more positive way. It seems to simply just hide the list items.

    Hello,

    Thanks for getting back to us.

    Kindly allow me to consult our developers about this and I will get back to you in a short while.

    We appreciate your patience. Thank you.

    Okay, thank you.

    Hello,

    At the moment, we can only suggest a workaround for the issue: using the same filter code, you can assign higher score number to the remaining tests, to account for the missing ones.

    For example, the ‘keywordInMetaDescription‘ test has a default score of 2, we can add the points for ‘titleHasNumber‘ (1) and ‘contentHasTOC‘ (2), making it worth 5 points in total.

    Please replace the code provided by my colleague with this:

    /**
     * Rank Math snippet to disable 'titleHasNumber' & 'contentHasTOC' tests.
     *
     * @param array  $tests Array of tests with score
     * @param string $type  Object type. Can be post, user or term.
     */
    add_filter( 'rank_math/researches/tests', function( $tests, $type ) {
    	unset($tests['title-readability']['titleHasNumber']);
    	unset($tests['content-readability']['contentHasTOC']);
    
    	$tests['basic']['keywordInMetaDescription']['score'] = 5;
    
        return $tests;
    }, 10, 2 );

    Hope that helps.

    Thank you. 🙂

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?rate=5#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘Disable Table Of Content?’ is closed to new replies.