Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
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

2 Answers 2

up vote 1 down vote accepted

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;
share|improve this answer
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

Maybe I am wrong and correct me, but i tried many things about this issues and nothing helpe, only this: $wp_rewrite->flush_rules(); but then categories stopped to work so i removed this code and nothing.


I left code intact as it was and just resaved my custom structures in settings via admin.

and now everything works perfectly..


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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