safesearch

#419195
  • Resolved DO NOT DISPLAY
    Rank Math free

    Is there a way to use Rankmath to set the meta tag for safesearch on each post? I have very little content that could possibly be flagged but certainly wouldn’t want my entire website being removed form search because nobody could ever guess why one platform or another says something is safe, moderate, or restricted so I’d like to just be able to set a flag on specific posts myself just in case.

    I know search engines use a specific meta tag and can’t understand for the life of me why wordpress makes it impossible for me to just add a meta tag with each piece of content but since this is for the search engines I’m guessing you might have a suggestion or a feature I can’t find.

    Thank you,

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

    Thank you for contacting Rank Math support today and bringing your concern to our attention.

    Currently, Rank Math doesn’t add meta tags to mark your posts or pages as explicit content.

    In this case, you can manually add the meta tag by adding the filter code below to your theme’s functions.php file:

    add_action('rank_math/head', function () {
      echo '<meta name="rating" content="RTA-5042-1996-1400-1577-RTA" />
      ';
    });

    You may change the value of the content attribute from the filter I shared.

    Here is a guide you can follow to add the filter:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

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

    I’ve added this but can’t find anything in the post rankmath tab nor in any of the rankmath dashboard pages on how to enable it for specific content. This is only needed for about one in thirty posts so I definitely don’t want it sitewide which I could do by adding the metatag to my header block.

    Prabhat
    Rank Math agency

    Hello,

    An approach that you can follow here is to create a category named “safe-content” (or any name you like) and add that category to the posts where you want the meta tag to be added.

    Then, add the below filter to your website and see if it gets you the desired output:

    add_action('rank_math/head', function () {
    	if( is_singular( 'post' ) && false !== has_category('safe-content') ){
    		echo '<meta name="rating" content="RTA-5042-1996-1400-1577-RTA" />';
    	}
    });

    In the above filter, you’ll need to replace “safe-content” with the name of the category that you’ll create.

    Let us know how that goes.

    Thank you.

    I would actually need a category for not-safe since it’s about 3% and way too many things have to be manually done for each post as is, better to just do things as needed. Would this just use the existing categories? then I would have a category visible on archives showing the NSFW category(very unwanted to drive traffic in that way)?

    Nigel
    Rank Math business

    Hello,

    Yes you could a assign an existing NSFW and replace the 'safe-content' in the snippet with the category you want to test for. In case the snippet causes the opposite result to what you want (adds safe search meta to safe posts and not to NSFW posts) change the false to true in the code snippet since we’ve inverted the test from ‘safe’ to ‘not-safe’.

    Hope that helps. Please let us know if you have questions.

    but this still makes a visible category on my site that then draws undesired traffic. I can hide the category from the site index RankMath creates but not in the site navigation

    Hello,

    Another thing you can do is save the post IDs that need to have this and then check for that in the filter to apply the metadata.

    Or maybe have a custom field on every post and check for the presence of a true value in that custom field in the filter.

    There are plenty of solutions for this, it’s just a matter of seeing what applies to your specific use case.

    Don’t hesitate to get in touch if you have any other questions.

    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 7 replies - 1 through 7 (of 7 total)

The ticket ‘safesearch’ is closed to new replies.