Rewrite rule for custom permalink structure

Based on your comments in the question, I believe I have an answer. Visit your WP Admin Dashboard (example.com/wp-admin/) and click on Settings, then Permalinks. Here you will want to choose “Custom Structure” and use the following structure (copy/paste): /articles/%postname%-%post_id%.html This will enable the slug “articles” and the structure you are looking for, which is … Read more

WordPress URL redirect and replace ? question mark

Into wordpress function file add following code and check it. add_filter(‘query_vars’, function( $vars ){ $vars[] = ‘parent’; return $vars; }); function archive_rewrite_rules() { add_rewrite_rule( ‘^(.*)/(.*)/?$’, ‘index.php?post_type=client&name=$matches[1]&parent=$matches[2]’, ‘top’ ); add_rewrite_rule( ‘^(.*)/?$’, ‘index.php?post_type=client&name=$matches[1]’, ‘top’ ); //flush_rewrite_rules(); // use only once } add_action( ‘init’, ‘archive_rewrite_rules’ );

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!

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

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