Template files for Custom Post Type and Taxonomy

The way taxonomies work with rewrites, is that they have a ‘slug’. Look at the codex under register_taxonomy, you will see the ‘rewrite’ argument. Supply it with array( ‘slug’ => ‘properties/location’ ) and refresh your permalinks. Otherwise, it’s looking for the following: mysite.com/property_location/office-space Refer to @vancoders answer for the template solution.

How can I emulate permalink behaviour on static pages

You need to add rewrite rules and the query_vars to fit your needs. For example. In your functions.php or plugin file: // Register a new vars to be used in the rewrite rules add_filter(‘query_vars’, ‘properties_add_query_vars’); function properties_add_query_vars( $vars) { $vars[] = “my_action”; // name of the var as seen in the URL return $vars; } … Read more

Best way to specify “article type” in URL

here’s a way to add article type with tags. First we add the taxonomy to our post add_action(‘init’, ‘article_type_init’); function article_type_init() { if (!is_taxonomy(‘article_type’)) { register_taxonomy( ‘article_type’, ‘post’, array( ‘hierarchical’ => FALSE, ‘label’ => __(‘Article Type’), ‘public’ => TRUE, ‘show_ui’ => TRUE, ‘query_var’ => ‘article-type’, ‘rewrite’ => true ) ); } } Than we hook … Read more

Resolve 404 on posts without category

Ok, resolved it in 404.php <?php $klo_link = $_SERVER[‘REQUEST_URI’]; if (preg_match(“/^\/[a-zA-Z0-9\-\_]+\/$/”, $klo_link)) { //echo “A match was found. \n”; //echo $klo_link; header(“HTTP/1.1 301 Moved Permanently”); header(“Location: “.get_bloginfo(‘url’).”/a”.$klo_link); exit(); }else { get_header(); } Put that at the beginning of the 404.ph

Changing permalinks structure without loosing SEO

You don’t need a plugin to achieve your goal. Use server redirect in the .htaccess file because it will not load the processor to interpret the WordPress PHP code and will not consume time. The redirect will be completed before the WordPress runs. RewriteRule ^[0-9]+/[0-9]+/(.*)\.html$ /$1 [R=301,L] Where [0-9]+/ is the numeric year and month … Read more