page not found for example.com/custom-post-name
this worked for me ‘has_archive’=> true, replace it with ‘has_archive’=> ‘jobs’, then flushed the permalinks
this worked for me ‘has_archive’=> true, replace it with ‘has_archive’=> ‘jobs’, then flushed the permalinks
When registering your custom post type have you tried to disable with_front in your rewrite array? For example, using an example for the post type book: add_action( ‘init’, ‘codex_book_init’ ); /** * Register a book post type. * * @link http://codex.wordpress.org/Function_Reference/register_post_type */ function codex_book_init() { $labels = array( ‘name’ => _x( ‘Books’, ‘post type general … Read more
I managed to find a solution thanks to Milo‘s previous answers on other related questions. I found this particular post Remove base slug in CPT & CT, use CT in permalink to be extremely helpful. My initial CPT with grandparent relationship rewrite remains the same: function cpt_child(){ $args = array( //code ‘rewrite’ => array( ‘slug’ … Read more
As said in the comments by Milo (many thanks!) the answer was already posted: Permalinks: custom post type -> custom taxonomy -> post
Short: You don’t need .html ending. .html ending can be easily archive by setting in Options > Permalink or using plugin like Custom Permalink. But that’s just personal style. Having html or not is now just different in length of URL. For me, the shorter one is better. It’s has no effect on SEO score. … Read more
Why not create an if statement to check if the email arg was passed, if so, redirect to the URL without the email. Something like: if ($_GET[’email’]) { //do unsubscribe stuff wp_redirect(‘http://www.domain.nl/email-acties/’); exit; } Unsubscribed!
CPT url rewriting : regular posts return 404 error
You’re almost there, but your understanding of how rules work is slightly off. Also I would recommend using the page_rewrite_rules filter: function wpse_224942_page_rewrite_rules( $rules ) { global $wp_rewrite; /* Don’t forget to change “my_query_var” in the rewrite rule too */ $new_rules = array( ‘bz/([^/]+)/?$’ => $wp_rewrite->index . ‘?pagename=bz&my_query_var=” . $wp_rewrite->preg_index( 1 ), ); return $new_rules … Read more
I have added extra rewrite rules for pages with no item_width and item_height in combination with pagination as follows: /** * Adds rewrite rules for shop category */ function gtp_add_shop_rewrite_rules() { // shop-category/category/item_width/item_height/page/2/ add_rewrite_rule( ‘^shop-category\/([^/]*)\/([^/]*)\/([^/]*)\/page\/([0-9]*)$’, ‘index.php?shop-category=$matches[1]&item_width=$matches[2]&item_height=$matches[3]&paged=$matches[4]’, ‘top’ ); // shop-category/category/page/2/ add_rewrite_rule( ‘^shop-category\/([^/]*)\/page\/([0-9]*)$’, ‘index.php?shop-category=$matches[1]&paged=$matches[2]’, ‘top’ ); // /shop-category/category/item_width/item_height/ add_rewrite_rule( ‘^shop-category\/([^/]*)\/([^/]*)\/([^/]*)$’, ‘index.php?shop-category=$matches[1]&item_width=$matches[2]&item_height=$matches[3]’, ‘top’ ); // /shop-category/category/item_width/ add_rewrite_rule( … Read more
Fixing the WP Post Object for Custom Route