How can I redirect post tag to actual post link using rank math plugin

#554982
  • Resolved Rocky
    Rank Math free

    How can I redirect post tag to actual post link using rank math plugin

    I mean not one by one but automatically when I share a post so if I add tags on post so if a user click on that tag from Google search he will redirect to the main post

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

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

    When you access tags, it lists all the articles in the tag. If you want the redirect the tag to the actual post then the tag needs to be used on only one post. Please confirm if you are using unique tag for each post.

    Looking forward to helping you.

    Thank you

    Rocky
    Rank Math free

    Yes I am using different tags for different posts but when when I checked the tags I opened a tag link under the tag link showing only post photo not showing the actual page

    Hello,

    Would you please share few affected URLs, so that we can investigate and provide better solution.

    Looking forward to helping you.

    Thank you

    Rocky
    Rank Math free

    Hello,

    Would you please try this adding this code in theme’s functions.php

    function redirect_to_single_post(){
    		global $wp_query;
    		if(is_tag()){
    			// Setup post data
    			the_post();
    			// Get permalink
    			$post_url = get_permalink();
    			// Redirect to single post page
    			wp_redirect( $post_url );
    		}  
    	 
    	}
    	add_action('template_redirect', 'redirect_to_single_post');
    

    Let us know how it goes.

    Thank you

    Rocky
    Rank Math free

    It’s working Big Thanks

    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/#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 ‘How can I redirect post tag to actual post link using rank math plugin’ is closed to new replies.