How to bulk edit wordpress page/post urls? - php

Recently I migrated some 1400 pages of static content to WordPress, but some of the URLs are messy and do not match the old site. Is there any way I can quickly edit many page URLs?
Only some URLs are messed up, so Database Query won't work in this case and In the WordPress codex, it is mentioned not to edit GUID column in the database.
Not sure if there is a plugin to do this. I am also using custom permalinks plugin for editing each page URL but it takes forever.
Thanks! :)

Related

Multilingual WordPress with redirects and dynamic content

Not sure how to title my issue.
I have a Wordpress website, where most values are stored in custom fields and is very independent of language - e.g. most values are numbers.
Instead of creating a multi-site with several network sites, I am looking for a much simpler solution. Let's say I want to create a German version. Then ideally, I could redirect all German users accessing the site with /de/ to a German version of the theme.
E.g.:
http://www.example.com/post-name/ directs to single.php in the theme files
http://www.example.com/de/post-name/ directs to single-de.php in the theme files. So they will have the same content, but the translation will be in the theme file.
The only problem I can see is the canonical URL, but I am guessing this can be dealt with as well. So my question is, is it possible to redirect all users that go to /subfolder/post-name/ to a specific theme file and display the content of that post with the specific theme file?
Is there any solution I have missed that might be easier?
My solution above would only require redirects and some additional theme files instead of creating a completely new multi-site and importing everything and having to keep this site updated as well.
There is already wp logic to do theme translations, so you don't need to re-invent that. If your content is in the theme or is the same for all languages (eg the numbers), then the translations should work well for this.
One can set WP-LANG dynamically. Viper's https://wordpress.org/plugins/in-their-language/ tries to do that automatically for admin area (not sure if it still works), or/and you could add a language switcher. Fairly easy, there's a variety out there https://www.google.com/search?q=wordpress+language+switcher.
this is an answer to
Is there any solution I have missed that might be easier?
not an answer to
So my question is, is it possible to redirect all users that go to
/subfolder/post-name/ to a specific theme file and display the content
of that post with the specific theme file?

Removing / Disabling Wordpress date and /blog links

Solution:
The problem was actually SEO Yoast. It creates "Archives" for posts and authors, creating a whole load of crap on the website.
The current template for our wordpress website originally was html only.
A guy we hired some time ago, did the transfer so to speak, but there are some problems.
At the moment the website contains "www.website.com/blog" and various "www.website.com/2018 or /2018/06" links that google does it's damnedest to index. Some of the links return a 404 occasionally as well.
Because we do daily blog post's everything is naturally copied over to those "/blog" pages. The results is 52% duplicate content (according to Siteliner)
I'm writing here looking for advice, because I don't know how to get rid of them or how to manage them to reduce the SEO related impact. I also didn't find post relating to this specific problem.
(example of the problem "multiorders.com/2018/07/page/2/" )
Our post links are set to website.com/sample-post, someone had suggested adding a "RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://yourwebsite.com/$3" into the .htaccess file.
I can tell you the basic structure to avoid the Duplicate content issue and the URL structure issue. Both are really important and can say main factor for Seo purposes.
Structure:
First one, Create a blog page (Already created on your website). On that page there must be shown the all blog posts that you have entered in the admin panel at POSTS menu. The lists of all blogs www.example.com/blog here as you said. In that page there should me pagination that means if you are showing 10 posts per page then the 11th post will be on the www.example.com/blog/2 and so on. (acceptable foe seo purpose).
Secondly, If someone clicks on the post or Read more button it should redirect the
single blog www.example.com/blog-post-name (perfect for seo).
To change the permalink (URL Structure) you have go to the admin settings menu -- permalink menu-- change to post name and Save.
Note: Take a backup before applying
Any questions, please ask..!!
The problem was actually SEO Yoast. It creates "Archives" for posts and authors, creating a whole load of crap on the website. As soon as I disabled those features all the extra pages vanished. Now all I need is to wait for Google to catch up.

Polylang is changing my homepage - Wordpress

I just finished my first custom wordpress site, using my custom theme, and now, I was starting to translate the site, I need it to have 3 languages.
So, I installed the plugin Polylang. But, I don't know why, when this plugin is active, my home page that is a custom page (page-home.php) is not being considered the homepage anymore. Since I never used this plugin before and I don't have much knowledge in wordpress, I have no idea how to solve this problem.
Can anyone help me?
I solved the problem. If you are using a custom page as your homepage, you first have to edit it. Just go there and save it, to assign this page to the default language you chose.
After that, you have to go to every page, post, custom post, and taxonomy, and save it using the default language. If you don't do that, the posts or the other contents of that current language will not be shown on the site, cause they have no language associated to it.
Then, you have to create a new version of every content you have on the admin (posts, pages, taxonomies) for the other languages you gonna use.

Custom Permalink with Page Name Wordpress

I have looked all over the place and can't figure out how to get this to work.
I want my urls for blog posts to look like this: "www.website.com/my-page/category-name/blog-post-title"
The issue I am having is that I have a page called "my-page".
So I have a page "www.website.com/my-page/" which is just a standard wordpress page, but I want the url for the blog post to look like it is under that page.
Here is what I have for the permalink so far:
/my-page/%category%/%postname%/
But this doesn't work and gets a 404 error when opening a blog post.
At this point I don't believe it can be fixed through the wordpress gui, so if anyone has any recommendations, it would be appreciated.
Thanks!
Edit: I wanted to add that the permalink works fine if I remove "/my-page" or if I simply modify it so it does not match the page.
First of all you should not use the category in front of your permalinks as it leads to bad performance (and some posts may have multiple categories): http://ottopress.com/2010/category-in-permalinks-considered-harmful/
The second thing is - it should work. I tried with a fresh installation on WordPress and I get the correct results.
Did you flush rewrite rules / save the new permalink structure?
Did you publish a post?
Is your server correctly configured to use permalinks?
Third possibility - if your permalink structure does not work for some reason you can define a custom permalink structure:
https://codex.wordpress.org/Rewrite_API

Migrating custom CMS website to Wordpress - how to add links correctly?

I'm migrating a website that has a custom CMS to Wordpress. We're talking about a giant site with thousands of posts.
At the moment I'm at the stage where I extract the content in JSON files by category and then insert them to the Wordpress DB via MySQL. I've even moved all the images and adjusted the URL using the PHP script.
However, my problem is with links inside the content. Some link to external sites (not a problem), while others link to other posts in the old site. How can I take those links and link to the correct, new Wordpress URL?
My link structure ideally would be /category/post/ in Wordpress. The old structure is similar, except the post URL is sometimes different by a few characters to the one coming out of Wordpress. It's not necessarily "post-title-is-the-url", sometimes it has a suffix like "_2". How do I go around the problem with the suffixes?

Categories