WordPress custom permalinks, pages are now 404

You need to setup your permalinks for menutype using custom rewrite rules. What you’ve done is apply the menutype prefix to everything, even though menutype isn’t relevant to everything, so things are being misinterpreted. You would need something similar to this: function custom_rewrite( $wp_rewrite ) { $feed_rules = array( ‘([^/]+)(/[0-9]+)?/?$’ => ‘index.php?menu_type=”. $wp_rewrite->preg_index(1).”&post_name=”. $wp_rewrite->preg_index(2) ); … Read more

How to use permalink query to go to specific tabs in posts

I’ve found out the solutions, though not perfect, but it gets the job done. Following is the code add_action(‘init’, ‘my_init’); function project_ace2_init() { global $wp; $wp->add_query_var(‘tab’); // Needed so get_query_var(‘tab’) will work add_rewrite_rule( //'(.+?)/([^/]+)(/([^/]+))?/?$’, //Original : ‘(.+?)/([^/]+)(/[0-9]+)?/?$’ ‘((?:(?!page|tag|category|author|search|feed|type))[^/]+)/([^/]+)(/([^/]+))?/?$’ ‘index.php?category_name=$matches[1]&name=$matches[2]&tab=$matches[4]’, ‘top’ ); } The rule is taken from the default WordPress rules for permalink as /%category%/%postname%/, … Read more

get_posts displaying wrong permalink for “continue reading” link

You need to reset the post data after your get_posts loop since your calling setup_postdata. It would be better to remove the setup_postdata all together. global $post; $recent_posts = get_posts( $yourargshere ); foreach($recent_posts as $post) : $return = ‘<h4 class=”recent-post-title c0″>’ . $post->post_title . ‘</h4>’; $return .= ‘<p class=”recent-content c0″>’ . apply_filters( ‘the_excerpt’, $post->post_excerpt ) … Read more

Rewrite rules for using the same base slug for multiple content types

Ok, the solution here turned out to be setting the correct priority on the add_action hook. Since we’re all hooking into init to register our post types per the Codex, the priority will determine which register_post_type function gets called first and, by extension, the order of the generated rewrite rules. So, I needed my “gemstone” … Read more