How to get relative page for every post: /post-1/contact. /post-2/contact

Yes, it’s possible, but think about what WebElaine wrote in comment. You’ll need a query variable (e.g. jobname) to store the name of jobs custom post type. You also need a rewrite rule that interprets /jobs/{post-slug}/contact address as a “contact” page and keep {post-slug} in query variable jobname. add_filter( ‘query_vars’, ‘se354723_query_vars’ ); add_action( ‘init’, ‘se354723_rewrite_job_contact’ … Read more

Remove part from dynamic url and redirect

I’ve fixed it with the following code: /** * Redirect ‘/tag/[0-9]/{tag_name}/’ to the correct tag. */ add_filter(‘request’, function($qv) { if (array_key_exists(‘category_name’, $qv) && preg_match(‘/(tag\/)([0-9]*)/’, $qv[‘category_name’])) { $qv = [ ‘tag’ => $qv[‘name’] ]; } return $qv; }); I’m not sure if this is the right way, but it works!

Using a template file for a specific custom URL

I don’t know what nepal is (text prefix only or maybe taxonomy term), but it is not the most important thing, you will correct it if necessary. Rewrite rule like this should resolve the case. add_action( ‘init’, ‘se356109_events_custom_rule’ ); function se356109_events_custom_rule() { add_rewrite_rule( ‘nepal/events/(.+?)/([0-9\-]+)(:?/page/?([0-9]+))?/?$’, ‘index.php?events=$matches[1]&paged=$matches[3]’, ‘top’ ); } If you need to use URL date … Read more