Tag Info

Hot answers tagged

1

The simplest and quickest solution would be to use the add_rewrite_endpoint function. <?php add_rewrite_endpoint( $name, $places ); ?> So in your case it would be something like this: add_rewrite_endpoint( 'user', EP_PERMALINK | EP_PAGES ); An user URL would look like this: http://www.example.com/my-page/user/john To access the variable: ...


1

Update You can make use of the add_rewrite_endpoint: add_rewrite_endpoint( 'schools', EP_PERMALINK | EP_PAGES ); You can then check in the sidebar for the schools variable: global $wp_query; if ( isset( $wp_query->query_vars['schools'] ) ) { // ... } What is worth mentioning is that your URL will look like ...


1

I think you can create a rewrite rule for each "region" to don't overwrite other important rules you could need (like pages, categories, etc..). I was playing with your code examples and with a small change in rewrite_resets could work: public function rewrite_resets() { global $wp_rewrite; foreach($this->ENABLED_POST_TYPES as $post_type) { ...


1

1.Login as the admin in WordPress. 2.Go to the Settings tab. 3.Go to the Reading tab. 4.Change the Blog pages show at most from the default 10 to any number *less than 10. For example, 5. 5.Save the changes. 6.View the blog. Hope that helps.


1

You need to flush rewrite rules after adding or modifying rewrite rules in WordPress. flush_rewrite_rules() can be used to flush rules. For more info check these links : https://codex.wordpress.org/Rewrite_API/add_rewrite_rule https://codex.wordpress.org/Function_Reference/flush_rewrite_rules



Only top voted, non community-wiki answers of a minimum length are eligible