How can I update my permalink structure in wordpress? - wordpress

This is the old url of my blog (wp 2.2)
http://myblog.com/category-name/post-name
ex.
http://myblog.com/shoes/i-like-shoes
and Im trying to change it to
http://myblog.com/post-id/post-name.html
ex.
http://myblog.com/717/this-is-my-first-post.html
Im moving my content from wp2.2 to wp2.8 and i want to change all the categories for the current content from whatever it is now to "classic"
The problem of course is that some of my pages have a high page rank and I need to maintain this...
this is becoming a headache for me to figure out.
your help is appreciated!

Go to: http://myblog.com/wp-admin/options-permalink.php. Or, if you want to navigate manually :), go to your wordpress dashboard. In the Settings menu go to "Permalinks".
Also see http://codex.wordpress.org/Using_Permalinks for more detail, especially the fields for making custom permalinks.
Edit
To quote the above,
Using %category% with multiple categories on a post, or %tag%
When you assign multiple categories to a post, only one can show up in the permalink. This will be the lowest numbered category (see Manage Categories). The post will still be accessible through all the categories as normal.
The same thing applies to using the %tag% field in your permalink structure.
So... As long as "classic" is the lowest numbered category you use, that will work as the category name in the permalink.
Your change in structure however will break any external links pointing to your posts so your page rank is going to change as well. Unfortunately you need to choose which is more important: changing to permalinks without category names, or maintaining the pagerank of old posts.

If you just changed category names, you can do a redirect in htaccess for just the category name, IF the rest of your URL structure remains the same, i.e. date and post name.
If you changed more than just a cateory name, or don't want to mess around with htaccess, then use something like the Redirection plugin to easily handle redirects.

Related

Is it possible to automatically add a slug to an already existing URL once permalink structure has been changed?

I am running a website in which the different posts all have an associated category: let's say, news, reviews, videos, etc.. We want to change how URLs are generated to incorporate the category before postname.
I will put an example:
old url: https:///www.myweb.com/amazing-new-car (with category in the post being news)
new url: https:///www.myweb.com/news/amazing-new-car (with category in the post being news)
I know how to do this by changing permalink structure in the wordpress settings to /%category%/%postname%/ but the problem is that this is applied to older entries too so when i try to access https:///www.myweb.com/amazing-new-car it gives me a 404 error. The problem here is that we have links to parts of our site sent to people, social networks and so and if they use them they will see this 404 error.
I've tried to use Redirection plugin to create a rule that can redirect old URLs to new URLs but it does not work (i've tried even wildcard redirection).
My question is: is there any way to do what i want rather than individual renaming of the links?
Thanks in advance, i hope i've explained well my problem
WordPress has all the tools necessary to make this change happen, and typically it does successfully redirect the slug from /slug to /news/slug
If you have added a category and haven't touched permalink settings, this is probably your problem.
Once you add a new category or post type into Wordpress, you should go into the Permalink settings and just click save. No need to change the settings if you are happy with them...

Wordpress main category with ghost categories

I wonder if there is any possibility to select a "main" category for a post, but also select "ghost" categories, so that a wordpress post only shows the main category but also appears on the other categories.
Example page: https://interestingengineering.com/autonomous-cars
If you go to that page you get all posts within the category autonomous-cars. However if you open for example the article about "The Future of Flying: A Japanese Flying Car Takes to the Skies" the main category on that site is "industry/vehicles":
https://interestingengineering.com/the-future-of-flying-a-japanese-flying-car-takes-to-the-skies
For me the main category would be industry/vehicles and the other categories where the post appears would be ghost categories.
Also I would like to know if the permalink structure could be preserved. Above example shows root/slug, however I would like to have root/main_category/slug.
Thank you in advance.
There are several ways to achieve what you want. I would recommend to use the Yoast SEO plugin as it includes all the features you need.
Since version 3.1 (2016) you can select the Primary Category, which allows to:
You can use the code from this valid answer from stack overflow to show only one category in your theme.
If you use in the permalink settings of WordPress /%category%/%postname%/ it will have your desired URL structure.

Update Permaklinks in WordPress

Specifically I am talking about the custom structure of Permalinks:
Well I noticed the list of categories names that are different when posts are made, the URL is different than the /%catagory%/ variable (or placeholder).
Simple fix, goto the Categories list under Posts and change the Slug. This is what the URL will show, not the name category.

Excluding a single category from Wordpress all posts results

I'm looking for a bit of help as I struggle to create a page that has a list of all of my clients' products. Currently I'm using this URL, which works great (with a caveat): http://tayloryourevent.com/?p=*
(note: on her site, both products and blogs are created as posts, but in separate categories)
As you can see, all the products show up nicely, but also included in the mix are blog posts, which I need to hide from that page.
My real problem is that I'm confused by the /?p=* and what that's doing. Since it's a page being created on the fly, I don't know where to look to get a glimpse behind the scenes.
2 questions:
Where is the /?p=* getting its theme from? Could I copy that theme and edit it to exclude the blog category?
-or-
Could I exclude the blog category with some kind of fancy URL work?
This plugin should be able to exclude blog categories: Simply Exclude

Post privacy in Wordpress

Can a post be hidden from home page, archive view, category lists etc. and viewable only if you have a direct link to it? The blog doesn't have registered readers and is open to public so that would be a mean of hiding some posts from public view without using the password protection.
I asked this question in Wordpress section and the idea there was to use conditional code so I'm asking the question here as well to get closer to the code.
If I used conditioning, would I have to input each post's ID separately to PHP file for archive, categories, search and such?
EDIT:
After reading a bit more all over, I had an idea of creating a private category and then use some kind of conditioning so that posts from that category are hidden. According to Codex, certain category can be hidden from, for example front page but I don't know if there's a way to hide it altogether except when you have a direct link.
Creating a "Private" category is a good solution. It is quite possible to hide this category altogether except via direct link. You just have to "block all the exits" with conditional code.
The default WordPress theme displays posts via the Post Loop. See http://codex.wordpress.org/The_Loop, especially the section entitled "Exclude Posts from Some Category". Just find all the places in your theme's PHP files (e.g. index.php) where this loop is used, and add the conditional code. You'd also need to filter your category list and blog archives in the side menu. Don't add filtering in single.php, otherwise the private post won't display on its own page.
You'd probably want to add a similar condition to filter search results so that private posts aren't leaked via the blog's search tool. There may be more "exits" I haven't thought of, but I'll be sure to update as I do. I'm glad to look at specific code if you so desire.
Understanding WordPress' post query and loop really opens up a world of possibilities for customization.
I found the simplest way - just use Simply Exclude Wordpress plugin. It has the option to exclude each post (or tag, for that matter) from front page, archive, search or feed. It works flawlessly. You can still view the posts by using direct links.
(Not actually an answer that includes code but a working solution nonetheless.)

Resources