Tag Info

New answers tagged

0

Add a rewrite endpoint instead of a rewrite rule and query var. This API function will do both of these things for you. function wpd_add_my_endpoint(){ add_rewrite_endpoint( 'information', EP_PAGES ); } add_action( 'init', 'wpd_add_my_endpoint' ); Now any page can have information appended to the end, and the value will be available via ...


0

Try this, I did a quick test and it worked for me. I created a page called 'central'. Don't forget to flush the rewrite rules after inserting this code. add_filter('query_vars', 'query_vars'); function query_vars($vars){ array_push($vars, 'information'); return $vars; } add_action('rewrite_rules_array', 'rewrite_rules'); function rewrite_rules($rules){ ...


2

The rewrite rule already exists to handle those requests, it's for pagination of a single page post type. You can get the value of the page number with get_query_var('page'). You can render all pages with the same template by creating a page-{page-name}.php template file.


6

Note: this is an incomplete answer which will be expanded upon incrementally The only reliable way to flush rewrite rules in multisite, without potentially destroying the permalink structure of the primary and or any other blog context (depending upon how and what you a switching to and from) is to flush rewrite rules in a given context like so: global ...


0

Just of the top of my head, something along this way might work: function wpse178647_rewrite() { add_rewrite_rule( '^([^/]+)/([^/]+)/?$', '' 'index.php?category_name=$matches[1]&pagename=$matches[2]', 'top' ); } add_action( 'init', 'wpse178647_rewrite' ); Completely and utterly untested.


0

Based on the comments of @Milo and using the rewrite analyzer plugin I found what I understand as a conflict in the rewrite rules?. The following url: exams/high-school/city-name/subject/math/ matches the following rules Pattern: (.?.+?)/page/?([0-9]{1,})/?$ Subtitution: pagename: exams/high-school/city-name/subject/math paged: 1 Pattern: ...


1

Change the Settings -> Permalink to Custom Structure /%category%/%postname%/ Now while editing the post, check only the subcategory and now the parent category is nested within the URL automatically.


1

I think you shoud use some .htacess rexrite rules either than relying on the wordpress rewrite functions. It seems more appropriate in your case. Try a rule like this : RewriteRule ^root/([a-zA-Z]+)/([a-zA-Z]+)/$ /root/$2/ [R=301,L] Insert it right after RewriteBase /



Top 50 recent answers are included