I am having a problem. I am running WP 3.05 with one custom taxonomy.

Here is the code to create the taxonomy:

function create_property_taxonomies() 
  // Add new taxonomy, make it hierarchical (like categories)
  $labels = array(
    'name' => _x( 'Property Types', 'taxonomy general name' ),
    'singular_name' => _x( 'Property Type', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Property Types' ),
    'all_items' => __( 'All Property Types' ),
    'parent_item' => __( 'Parent Property Type' ),
    'parent_item_colon' => __( 'Parent Property Type:' ),
    'edit_item' => __( 'Edit Property Typee' ), 
    'update_item' => __( 'Update Property Type' ),
    'add_new_item' => __( 'Add New Property Type' ),
    'new_item_name' => __( 'New Property Type' ),
    'menu_name' => __( 'Property Type' ),

  register_taxonomy('property_type',array('sbproperty'), array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => true,
global $wp_rewrite;
    $wp_rewrite->extra_permastructs['property_type'] = array('%property_type%', EP_NONE);

I have used the extra permastruct so the taxonomy just appears on the base url like site.com/taxonomy-slug instead of site.com/taxonomy/taxonomy-slug

I am also using the top-level-cats plugin to do the same for original taxonomies.

But this is causing a conflict with my pages. When I remove the permastruct the page loads on the pretty permalink, but with my permastruct on it does not, it gives a 404 for all top level pages.

  • You might wanna check $permalink_structure = get_option( 'permalink_structure' ); in case you're migrating from one host to another ... I know it's not the solution, but it might help you in other cases. – kaiser Feb 15 '11 at 11:31
  • To clarify things: site.com/houses/ can be a page, a property_type or a category? What is your current permalink structure? (Use @Jan in your reply and I get a notification) – Jan Fabry Feb 15 '11 at 13:29

Sorry guys, this is becoming a habit, but I found a solution, as follows:

set rewrite to false in taxonomy registration: register_taxonomy('property_type',array('sbproperty'), array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => false ));

And create my own rule


function flushRules(){
global $wp_rewrite;

function wp_insertMyRewriteRules($rules)
$newrules = array();
$newrules["([a-z]+)-in-turkey-for-sale/?$"] 'index.php?property_type=$matches[1]-in-turkey-for-sale';
return $newrules + $rules;
  • 2
    Horrible idea, flushing rewrite rules on init. Just visit the permalinks page to flush rewrite rules. Flushing the rewrite rules is a very memory-heavy process; besides, it only needs to be done once. – John P Bloch Feb 15 '11 at 22:05
  • Which is why I comment out that part after I add any new rules. – Liam Bailey Feb 17 '11 at 10:17

I tried many things to solve this issue and nothing helped, except this:


but then categories stopped working, so I removed this code.

And then an idea came up :)

I left the code intact as it was and just re-saved my Custom Structure in Permalink Settings via admin, and now everything works perfectly.

So solution is to re-save Settings > Permalinks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.