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

Rewrite Rules are Redirecting

Because WordPress use its own rewrite system with regular expression, so that its rewrite rule when you turned on the permalink, it is just index.php. When it is turned on. It will scan your url and put into parameters. If you do them in .htaccess rewrite, sometimes you will collide in some situations so you … Read more

How to replace custom post type with custom taxonmy in permalinks

WordPress is a query based system, you need to first understand that if using permalinks and when a link http://domain.com/hospital/hospitalname is submitted, WP analyses it internally as post type = hospital name = hospitalname And then create a query to look up. It is likewise for other links such as http://domain.com/cityname/hospitalname Assumptions Before a custom … Read more

Custom account page that accepts a query parameter

That add_rewrite_endpoint(“scheduled-order-create/([0-9]+)/?”, …); doesn’t work because add_rewrite_endpoint() doesn’t work with custom RegEx pattern. And remember that in addition to default public query vars like cat, tag, year and author, WordPress also makes all public post types and taxonomies (with a non-empty query_var value when registered — see register_post_type() and register_taxonomy()) be readable from the URL … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)