• In my wordpress installation, i’ve a default permalink-structure for all my blog posts. For example ‘blog’.

    In this forum post, i’ve described the solution of multiple taxonomies below a custom post type in the permalink structure with the rewrite setting.

    To change the rewrites in my portfolio custom post type from

    https://yourdomain.com/blog/portfolio/my-post-1-2-3

    to:

    https://yourdomain.com/portfolio/my-post-1-2-3

    I used the rewrite setting “with_front”:

    register_taxnomomy('portfolio-category', array('portfolio'), array('rewrite' => array('slug' => 'portfolio/category'), 'with_front' => false));

    The permalink looks now ok, but the redirection ends in an 404 error.

    I know this is currently a common problem. I’ve reverted all settings, the newest nighly build, no plugins and reloaded the permalink table. This must be an error in the nightlybuild itself.

    The same setting in the register_post_type works without any problems.

    -> Ticket: https://core.trac.www.ads-software.com/ticket/11449

Viewing 6 replies - 1 through 6 (of 6 total)
  • I have the same problem with 3.0 RC2.
    Any ideas?

    Been having this issue with custom post types in general. I seem to have a fix that I’m hoping will work for you guys. It’s a two parter.

    After you’ve made your changes to functions.php or wherever you’re adding/editing post types or taxonomies,

    1) go into the wp_options table in your database and clear out the option_value field for option_name rewrite_rules .

    2) Then go back into your WordPress admin > Settings > Permalkinks and click the save button.

    This should reset your rewrite rules to reflect your new rewrite settings for your taxonomy.

    @stunnaboi

    worked for me!

    thank you

    If you are writing a plug-in, add:

    add_action('admin_init', 'flush_rewrite_rules');

    your rewrite rules will be flushed when you activate the plug-in then.

    i just used
    'rewrite' => array( 'slug' => 'portfolio/categoria', 'with_front' => false)
    and than clicked on the save button in “admin > Settings > Permalkinks”

    it worked for me

    After hours of experimentation this worked for me…

    The key is to ensure when you first register the post type that your post type name is different from your page (if you’re using a page template).

    This rule of thumb also applies if you’re using a plugin like: https://www.ads-software.com/extend/plugins/custom-post-type-ui/ – check the code it outputs!

    My page is named ‘Products

    My post type is named ‘product‘:

    register_post_type('<strong>product</strong>', array(	'label' => 'Products','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => ''),'query_var' => true,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'labels' => array (
      'name' => 'Products',
      'singular_name' => 'Product',
      'menu_name' => 'Products',
      'add_new' => 'Add Product',
      'add_new_item' => 'Add New Product',
      'edit' => 'Edit',
      'edit_item' => 'Edit Product',
      'new_item' => 'New Product',
      'view' => 'View Product',
      'view_item' => 'View Product',
      'search_items' => 'Search Products',
      'not_found' => 'No Products Found',
      'not_found_in_trash' => 'No Products Found in Trash',
      'parent' => 'Parent Product',
    ),) );

    You may find you have to gut your wp_posts for a clean slate, but this solution requires no additional slug rewrites.

    Best,

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘register_taxonomy with rewrite param “with_front” ends in error 404’ is closed to new replies.