Have two different URLs show the homepage

WordPress will always try to redirect to the canonical URL to prevent duplicate content, so you’ll have to disable that mechanism to get another URL to display that page. First, your rewrite rule: add_rewrite_rule(‘^page1’, ‘index.php?pagename=your-page-name’, ‘top’); Then filter redirect_canonical to return false if the requested URL is your 2nd home URL: function my_redir_check( $redirect_url, $requested_url … Read more

In WordPress how do you create a custom post type with the author’s name in the slug?

My plugin Custom Post Permalinks allows you to set permalink structures for custom post types and it supports post authors as part of a permastruct. However, while my plugin will enable you to set up that structure, I don’t suggest using that structure. That structure will essentially make WordPress interpret all top-level pages as 404 … Read more

How can you handle rewrite rules for custom post types with option to filter on custom taxonomy terms?

This is what I’ve used in the past for a similar requirement; register_post_type(‘movie’, array( ‘rewrite’ => array(‘slug’ => ‘movie’) )); register_taxonomy(‘movie_location’, ‘movie’, array( ‘rewrite’ => array(‘slug’ => ‘movies’) )); /** * Add rewrite rules for ‘base’ archives. * @param object $r Instance of {@see WP_Rewrite} */ function my_custom_rewrite_rules(&$r) { $rules = array( ‘movies/page/?([0-9]{1,})/?$’ => ‘post_type=movie&paged=’ … Read more

Can’t add external rewrites

First off, don’t ever do this: add_action(‘init’, ‘flush_rewrite_rules’); Every time WordPress loads, you are going to flush the rewrite rules. You only need to do this once to make sure your rewrite shows up. Second, add_rewrite_tag only takes two arguments, the tag and the regex. If you want to specify a query variable directly, you’ll … Read more