Show category name in category.php when posts assigned to multiple categories

For the heading on a category archive use either: the_archive_title(); Or: single_term_title(); The first one can be used on the template for any archive, while the second should only be used on category, tag, or taxonomy archive templates. You shouldn’t need to get anything from any of the individual posts. They may have other categories … Read more

WP appending -2 to the end of my slug

It might not be a Page. WordPress is very picky about slugs sometimes. You might have to dig in the database’s wp_posts table and see what other post exists somewhere with that name – sometimes it can be an odd thing like a Media Library (image) file. Once you find it, if you completely delete … Read more

Duplicate Slugs on multilingual site (with Polylang)

Go on your back-office, and go on Polylang (Languages) Settings. Then, on URL modifications, check if the option “The language is set from the directory name in pretty permalinks” is checked. If not, check it. Then click on Save changes. Now, you should see this option below : “Share slugs Activated” “Allows to share the … Read more

WordPress Page Slug with URL custom template

Eventually I found out a solution. Below is how I have achieved this. In my functions.php file, I have put below code. add_filter(‘query_vars’, ‘add_user_var’, 0, 1); function add_user_var($vars){ $vars[] = ‘user’; return $vars; } add_rewrite_rule(‘^user/([^/]+)/?$’,’index.php?pagename=user&user=$matches[1]’,’top’); This generally adds a rewrite rule if it finds user in the URL. Now I have added a page template … Read more