Custom taxanomy and custom post type – pagination leads to 404
I did solve it by myself – I had to register the taxonomy BEFORE the post type…
I did solve it by myself – I had to register the taxonomy BEFORE the post type…
You can try add_action( ‘init’, ‘wpse26388_rewrites_init’, 10, 0); function wpse26388_rewrites_init(){ add_rewrite_rule( ‘^us-dot-numbers/([A-Za-z0-9-]+)/?’, ‘index.php?page_id=642&dotNumber=$matches[1]’, ‘top’ ); } add_filter( ‘query_vars’, ‘wpse26388_query_vars’ ); function wpse26388_query_vars( $query_vars ){ $query_vars[] = ‘dotNumber’; return $query_vars; } Remember to flush_rewrite_rules();
Change URLs in default WordPress slider to relative from absolute
I handled this with a pre_get_posts hook (thanks, @Milo), passing in the URL part that corresponds to the slug I need. Hope this helps someone down the road. Improvements are welcome. Thanks. function filter_team_news_archives_by_sport_taxonomy($query) { if (is_post_type_archive(‘team-news’) && $query->is_main_query()){ // Get $sport_slug from URL — https://stackoverflow.com/a/36002190/4107296 $url = (isset($_SERVER[‘HTTPS’]) ? “https” : “http”) . “://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”; … Read more
I found solution – I needed to run flush_rules() method at least once to clean cache. //Ensure the $wp_rewrite global is loaded global $wp_rewrite; //Call flush_rules() as a method of the $wp_rewrite object $wp_rewrite->flush_rules( false );
Rewrite URL for Search + Special Characters / Umlaute
Rewriting URL with 3 custom meta fields to add onto Pages
Url rewrite, add rule, redirect as POST request?
Managed to get this working with a little help from Debug This plugin and some little hints from similar questions. At least so far, after some quick testing, I haven’t come across any negative side effects. The problem, if I understood correctly, is that if I have my cpt rewrite set to same slug as … Read more
I just realized i used different kind of rewriting which didn’t require @Jacob’s codes (using add_rewrite_endpoint) add_action(‘init’, ‘wpse42279_add_endpoints’); function wpse42279_add_endpoints() { add_rewrite_endpoint(‘play’, EP_PERMALINK); } And then i used this conditionals on the single page: global $post; $pid = $post->ID; $var = get_query_var( ‘play’ ); if( !empty($var) and $var == $pid) : // do stuff endif; … Read more