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

Create a custom plugin with dynamic child pages listing database records

A basic implementation could go like this: Setup public query variables This lets you fetch these later through get_query_var() add_filter( ‘query_vars’, function( $vars ) { $vars[] = ‘team_category’; $vars[] = ‘team_id’; return $vars; } ); Add a rewrite rule This is responsible for turning a url like /team/allstars/999 into a format WordPress can handle. Make … Read more

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