Custom post type child page 404
When you register a new post type for the first time, you need to visit Settings -> Permalinks so WordPress can set up the permalink rules for it. You don’t even need to hit save, visiting the page is enough.
When you register a new post type for the first time, you need to visit Settings -> Permalinks so WordPress can set up the permalink rules for it. You don’t even need to hit save, visiting the page is enough.
plugin_dir_url( __FILE__ ) will return the URL of the current files directory. Usage would be: $url = plugin_dir_url( __FILE__ ) . ‘/newfolder/newfolder/index.php’;
You can use the pattern (([^/]*)/)? to match a full <component>/ construction – this will create a multi-dimensional element in the $matches array, with the first level containing the full expression and the internal matches containing an item with <component> without the “https://wordpress.stackexchange.com/” character. However, you need to be very careful in the way you … Read more
Are you sure your rewrite rules are actually being saved? How are you calling this function to setup the rewrite rules? Action? What about flushing rewrite rules, are you flushing them anywhere in your project? Disable all of your plugins and test to make sure one isn’t flushing rewrite rules on every page load. As … Read more
how to change some of the rules in the database
While it’s possible to get rid of WP_Query in WP load process it’s pretty horribly inconvenient to accomplish. 🙂 Let’s recap the process as related to rewrite: Web server takes pretty permalink and rewrites it to WP’s index.php. WP takes “pretty” part and applies its rewrite rules to it, turning it into query variables. Query … Read more
You have to make your rewrite rules account for the paged parameter, because otherwise they won’t. It would look somewhat like shown below. function test_add_rewrite_rules() { add_rewrite_rule( ‘businesses/(eat|stay|play)/(.+)/page/([0-9]+)/?$’, ‘index.php?post_type=businesses&display_category=$matches[1]&filters=$matches[2]&paged=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘businesses/(eat|stay|play)/page/([0-9]+)/?$’, ‘index.php?post_type=businesses&display_category=$matches[1]&paged=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘test_add_rewrite_rules’ );
I want to add one extra field to my URLs, I’m using Rewrite functions but it doesn’t work
You can always check the value of the result with the function var_dump as follows: var_dump( $matches[1] ); In this case, I think is returning an Array with the results you should try to out. <?php echo $matches[1][0] ; ?>
Rewriting base name Taxonomy same Post Type