WordPress.org

Support

Support » Plugins and Hacks » Redirect to a specific WordPress page instead 404

Redirect to a specific WordPress page instead 404

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi I was wondering about this too. Anyone can give advice on this topic?

    Maybe there isn’t a solution to fix this?

    i tried with this code

    <?php
    	global $wpdb;
    	$post_id = 30;
    	$post_exists = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE id = '" . $post_id . "'", 'ARRAY_A');
    	if($post_exists){
    	  echo 'Sorry, you do not have permission to view this page.';
    	} else {
    	  echo 'Sorry but the page you are looking for cannot be found.';
    	}
    				?>

    but this doesn’t solve the problem because it just checks if the post exists and it shows the proper message, anyway the post always exists.

    Plugin Author Kevin Behrens

    @kevinb

    There is no support for redirecting to an arbitrary page, but if you enable Roles > Options > Features > Hidden Content Teaser, you can specify a custom denial message (including html if desired) for each post type.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Redirect to a specific WordPress page instead 404’ is closed to new replies.