How to change old permalink?

Well you have several options, but you definitely need to redirect the url. You can either achieve the redirection via a WordPress plugin or through your .htaccess file. If you would like to use a plugin, I would recommend “Redirection” by John Godley. It is easy to use. Just type the url you want to … Read more

How to 301 redirect from one url to another properly

Generally, you can use .htaccess (a file located at the root of the folder you are serving) and a regular expression to do the redirect. I used Yoast to generate mine: RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(?!page/)(.+)$ https://example.com/$4 In the regular expression above I match anything at the beginning then I match / followed by 4 digits (a … Read more

Programmatically Restrict WordPress from using certain URLs or sub-directories

The easiest way in WP would be to use wp_unique_post_slug hook. It takes 6 params: apply_filters( ‘wp_unique_post_slug’, string $slug, int $post_ID, string $post_status, string $post_type, int $post_parent, string $original_slug ) So you can target given URL and modify the slug would conflict. Let’s say you want to prevent WP from using website.com/eat address. All you … Read more

Custom permalink structure: /%custom-taxonomy%/%post-name%/ (without CPT slug)

I managed to find a solution $args = array( ‘labels’ => $labels, ‘public’ => true, ‘publicly_queryable’ => true, ‘show_ui’ => true, ‘show_in_menu’ => true, ‘query_var’ => true, ‘rewrite’ => array ( ‘slug’ => ‘products/%catalogs%’, ‘with_front’ => false), ‘capability_type’ => ‘post’, ‘has_archive’ => ‘products’, ‘hierarchical’ => false, ‘menu_position’ => 4, ‘menu_icon’ => ‘dashicons-cart’, ‘supports’ => array( … Read more

Removing leading zeros from custom permalink structure

How about using custom rewrite tags/structure? So we’ll be using these two rewrite/structure tags: %monthnum2% does the same thing as the %monthnum% tag, but without a leading zero; e.g. 3 and not 03 for March. %day2% does the same thing as the %day% tag, but without a leading zero; e.g. 7 and not 07. The … Read more

Dynamic Template file for subpage

The taxonomy term should helps you, see the documentation. The possibilities taxonomy-{taxonomy}-{term}.php taxonomy-{taxonomy}.php tag-{slug}.php tag-{id}.php Your example tag-about.php See the template hierarchy for tag for a deeper documentation about this feature. So it is possible to have a specific template without coding, a plugin.

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