WordPress.org

Support

Support » How-To and Troubleshooting » Redirect Single Post to a Category

Redirect Single Post to a Category

  • Hello,

    I’m really struggling with this and cant get it resolved.

    All I want to do is set it up so a post on my main page….when you click it, it takes you to a category page.

    I have tried all of the redirect plugins with no success. I think my theme dislikes them.

    My theme is called grid-a-licious.

    Please help, I thought this would be straight-forward, but it’s proving to be a nightmare!

Viewing 4 replies - 1 through 4 (of 4 total)
  • I was looking at quick-pagepost-redirect-plugin to see if it did exactly that.
    Also looking at this solution:

    function thisismyurl_redirect() {
    
    	if ( is_single() ) {
    		global $post;
    
    		$post_id = $post->ID;
    		if ( !empty( $post_id ) ) $redirect = get_post_meta ( $post_id, 'redirect', true);
    
    		if ( ! empty( $redirect ) ) {
    			wp_redirect( $redirect, 301 );
    			exit();
    		}
    	}
    
    }
    add_action('template_redirect','thisismyurl_redirect');

    (should be added to your WordPress functions.php file)

    If you get a solution i will be very interested to hear abt it.

    wordpress.org/extend/plugins/simple-301-redirects/

    Why dont you use this plugin ?

    avinash-woodun

    Hi Avinash,

    Thanks for your reply. I have tried this plugin as well as several others (including redirection) but they don’t work.

    Is there any other method?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Redirect Single Post to a Category’ is closed to new replies.
Skip to toolbar