Index authors with posta only

#1034410
  • Resolved Diana Talpos
    Rank Math free

    Hello.How can I index only the authors who have posts?
    I would like the author pages without any posts to have a noindex status.

    Thank you!

Viewing 1 replies (of 1 total)
  • Hello,

    We apologize for the issue you’re facing. To index only the authors who have posts while setting a noindex status for author pages without any posts, you can follow these steps:

    1. Set Noindex for Author Archives: First, you need to set the author archives to noindex by default. You can do this by navigating to WordPress Dashboard → Rank Math SEO → Titles & Meta.

      • Find the Author Archives Robots Meta option and enable the No Index setting.

      Navigate to Titles & Meta

    2. Use Custom Code: To conditionally set the noindex for authors without posts, you may need to implement a custom function in your theme’s functions.php file. This function would check if an author has posts and set the robots meta tag accordingly. Here’s a basic example:

      add_action('wp_head', function() {
         if (is_author()) {
             $author_id = get_queried_object_id();
             $post_count = count_user_posts($author_id);
             if ($post_count == 0) {
                 echo '';
             }
         }
      });

      This code checks if the current page is an author archive and counts the number of posts by that author. If there are no posts, it adds a noindex meta tag.

    3. Save Changes: Make sure to save any changes you make in the settings or in your theme files.

    If you’re not comfortable with coding or want to ensure everything is set up correctly, we recommend our professional setup service. You can find more information about it here. This service requires a PRO subscription and is designed to help users like you ensure their plugin setup adheres to the latest SEO standards.

    Thank you for raising this concern! If you have any further questions or need assistance, feel free to reply to this ticket.

    Sources:
    How to Noindex URLs With Rank Math » Rank Math

    This is an automated reply from Rank Math Support Bot. If you need further assistance, please reply to this topic and a human support agent will reply to you shortly.

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

The ticket ‘Index authors with posta only’ is closed to new replies.