Create Custom URL structure for specific Post category using Post ID instead of post name
Create Custom URL structure for specific Post category using Post ID instead of post name
Create Custom URL structure for specific Post category using Post ID instead of post name
Because it’s not enough to register your rule, you need to flush the rewrite rules for it to take effect. An easy way of doing this is to visit the permalinks settings page. This is true regardless of where the rewrite rule came from. The most common reason people encounter this is because of the … Read more
Add rewrite rule for custom post type single page
Show index.php template instead of 404 page template
Is there a problem with the code? Your code is already properly adding the lang query variable to the homepage URL. But you need to understand these points: On the homepage URL becomes http://localhost/mywebsitename/?lang=en which should be ok $wp->request is empty on the homepage, hence the above URL is expected. And you could use get_queried_object()->post_name … Read more
This code adds the subid parameter if does not exist to the current URL. Use this plugin to insert the php code: https://wordpress.org/plugins/my-custom-functions/ But you need to use add_action() to call this function somewhere. function my_change_url() { global $wp; $current_url = home_url(add_query_arg(array($_GET), $wp->request)); if ( empty($_GET[‘subid’]) ) { $cuser = wp_get_current_user(); $username = $cuser->user_login; $current_url … Read more
How to rewrite URL back to default custom URL if no destination found
WordPress how to prevent URL encoding in URL of taxonomy terms
This should be in a comment, but can’t format much in there. Create a relationship between your CPT and Page. For example, create a custom taxonomy for your CPT and programatically add the pages as terms. Or, you can even create a meta field. Create a placeholder for the URL while registering the CPT. For … Read more
if i good understand your problem, you should to go: Dashboard -> Settings -> Permalinks and in “Common Settings” section select checkbox “Custom Structure” and here paste: /my-blog/%postname%/ and save changes. Now refresh your page and go to random post and your url should be like: https://example.com/my-blog/this-is-the-article-name Good luck!