add_rewrite_rule() not playing nice with child pages
if it’s a child page, you have to update pagename to reflect the parent/child path: add_rewrite_rule(‘about/testing/([^/]+)?$’, ‘index.php?pagename=about/testing&event_slug=$matches[1]’, ‘top’ );
if it’s a child page, you have to update pagename to reflect the parent/child path: add_rewrite_rule(‘about/testing/([^/]+)?$’, ‘index.php?pagename=about/testing&event_slug=$matches[1]’, ‘top’ );
I am not sure if this is the best solution or not, but it works: function movie_review_permalink( $url, $post, $leavename ) { $category = get_the_category($post->ID); if ( !empty($category) && $category[0]->slug == “test” ) { //change ‘test’ to your category slug $date=date_create($post->post_date); $my_date = date_format($date,”dmY”); $url= trailingslashit( home_url(“https://wordpress.stackexchange.com/”. $category[0]->slug .”https://wordpress.stackexchange.com/”. $post->post_name .’-‘. $my_date .”https://wordpress.stackexchange.com/” ) ); … Read more
the solution is simple, there is a filter to change the lost password url. Try this : add_filter( ‘lostpassword_url’, ‘wdm_lostpassword_url’, 10, 0 ); function wdm_lostpassword_url() { return site_url(‘/signin?action=lostpassword’); }
I solved it myself (with you guys’ help): It was easy as anything: ‘rewrite’ => array( ‘slug’ => ‘videos’, ‘with_front’ => false ),
You may not like this answer, but it’s a quite simple, and probably most recommended. Don’t set these pages as child pages. There are numerous ways of getting pages to list out in a child-like order – WP Menus. Use that instead, and you will cause less stress on your WordPress installation – having to … Read more
get_permalink returns default link
Ok, so I will get negative points for this, but it should solve your problem, please dont be mad at me. Before anyone downvote me for this, I must say that I have nothing to do with the developers of this plugin: For custom taxonomies and custom post types I often use a plugin named … Read more
This is very easy to do by adding custom rewrite rules. This should get you started: add_action( ‘init’, ‘wpse_100386_rewrites’ ); function wpse_100386_rewrites() { add_rewrite_rule( ‘case-studies/room/([^/]+)/?’, ‘index.php?the_room=$matches[1]&post_type=the_case_study’, ‘top’ ); add_rewrite_rule( ‘videos/room/([^/]+)/?’, ‘index.php?the_room=$matches[1]&post_type=the_video’, ‘top’ ); } As always when changing rewrite rules, be sure to flush your rewrite rules by going to Settings -> Permalinks and click … Read more
You can try this (sorry, not previously tested). See comments inline for explanation: RewriteEngine On ## if any string separated by | is matched, it will append to ?page= RewriteRule ^(members|add-members|delete)$ admin.php?page=%1 [L,E=CLEAN_CONTACT_URL:1,QSA] ## If querystring starts with page= and is followed by any string separated by | ## put that in the first group. … Read more
Like Bainternet said in comments, you’ll need to mess with add_query_var as well as add_rewrite_rule. We usually do something similar to: global $wp; $wp->add_query_var( ‘some_var’ ); add_rewrite_rule( ‘some/path/([^/]+)/?$’, ‘index.php?some_var=$matches[1]’ ); See this WordPress Trac ticket, as well as documentation on add_query_var and add_rewrite_rule