Articles of permalinks

Post being redirected to attachment post

That’s strange issue I have on this one website. Similar to this problem and I am trying to get this fixed from last couple of weeks. This website have latest WordPress installed and /%postname%/ permalink structure. Sometimes, when I try to view a post, I get redirected to attachment post /?attachment_id=358 instead of the post […]

Help with a TV series Rewrite structure

Not sure if this is possible, but bear with me. I think I am halfway there. First a little background: I’m using the build in hierarchy in WordPress to form relationships between post types. I have a post type called series that holds info on a TV series. I have another post type called content […]

Multi-language permalink in qtranslate

I am using qtranslate plugin for my WordPress site to make it a multi-language site. Now I have got a requirement like For English the url should look like www.sitename.com/contact-en For French the url should look like www.sitename.com/fr/contact-fr How can I accomplish this? (qTranslate is the plugin used) Note: There should not be any post […]

permalinks with get variables

I’m trying to create my own permalinks with wordpress rewrite API. I have been registering my get variables as it follows add_filter( ‘query_vars’,’driver_vars’ ); function driver_vars( $vars ) { global $wp_query; array_push($vars, ‘cat_name’); array_push($vars, ‘group’); return $vars; } and making my own rule as it follows function drivers_rewrite_rules( $rules ) { global $wp_rewrite; $newrules = […]

Get current URL (permalink) without /page/{pagenum}/

How to get current URL (it can be a homepage, an archive, post type archive, category archive etc) but always without the /page/{pagenum}/ part if it’s present? So, if the real URL is: example.com/category/uncategorized/ OR example.com/category/uncategorized/page/2/ the return value will always be example.com/category/uncategorized/

How to create a permalink structure for posts in a specific category

I am building a single author blog that will include multiple categories. One main category is “Movie Reviews.” The author will leave a short review every time they watch a movie – even if they’ve seen the movie in the past and reviewed it on their site in the past. For the “Movie Reviews” category […]

How would I create a different permalink structure for pages and posts?

Right now I have pages like “about”, “resources”, etc and the urls are /about and /resources with a custom permalink structure as /%postname%. For “news” section it’s the posts and it’s at /news and that’s great. The problem is I want the new stories to be /news/the-name-of-the-story not /the-name-of-the-story. Can that be accomplished in the […]

WordPress thinks my custom route is a 404

I created a plugin that sets up a custom route and then loads a template file for that url. Everything works fine, except that WordPress seems to think it’s a 404 even though it’s correctly rendering my template. For instance it says 404 in the document title and an error404 class is added to <body> […]

URL rewrite based on a custom field value

I’m working on a migration from another CMS to WordPress. The old site had terrible SEO-unfriendly URLs in the format http://example.com?lid=1234. We have imported all the posts from the old site into WordPress and are storing the lid as a custom field. We would love the old URLs to still work if possible, but as […]

Stop WordPress appending `-2` to the end of my url after i change it

When i try to set the url of a page in wordpress (4.2) it keeps apending -2 to the end of the url, i guess its becuase this ulr already exists, but i checked and it dosnt, although at one time it did but that page has since been deleted. Any idea how i can […]