Migrating Large PHP Website to Wordpress - php

I used to have a Wordpress website a few years ago. After getting hacked, I decided to create my own PHP script and extract the necessary data from my Wordpress Installation and keep the same URL structure. Now, a few years later, I want to move back to Wordpress for various reasons. My site has over 2500 articles, and manually importing these articles will be a pain, and I want to keep the same URL structure, as to not lose any SEO.
Here is my SEO structure
https://www.example.com/post-id/post-title-all-lower-case/
I have a database with the following values:
post id
post url (the url slug)
category id
post title
post content
etc..
I can easily create an xml or rss feed with these values for the 2500 posts. But I don't know how to import this content to wordpress. Anyone got any ideas on how I can go through a smooth transition?
I just need this content imported. Creating the theme and everything else is the easy part.
All help is greatly appreciated!
EDIT: SOME PROGRESS!
I have uploaded all my content to a new wordpress installation. Each post has a custom field with a unique number. This number MUST be the post_id.
How do I make it so that I make this custom field the post_id of that post?
All help is greatly appreciated!

You can use this wordpress plugin for safe migration.
https://wordpress.org/plugins/duplicator/

I did something like this a couple of years ago, using MS Excel to concatenate the cells to export to a csv file we could load directly to the mysql db using PHPMyAdmin. We were also doing categories, which involved various tables. For posts, I think you can load directly to the wp_posts db table. I'd create a single post in WP, look to see what table counts change. The look at the tables that changed to see how you would need to populate a csv file to load your content.

Related

How to Search and fetch result from database other than wordpress in wordpress?

I am new to wordpress coding and need some help regarding fetching some data from different database which is not wordpress database and show on wordpress website. Let me make it more clear,
I have two CMS installed
1. WordPress
2. CRM
In CRM I have some user data which i want to display on wordpress. I searched web but almost each answer is showing retrieving data from wordpress database itself. If you have any way to do it please suggest.
There isn't an "as is" solution, every database structure of every CRM is different.
You will have to create your own custom database queries, and output the data into variables that you can use to create new queries on the other database.
Next, you will want to format your data and present it into a page.
what i understand from your post is thatyou want to show contents of a different database in your wordpress site. i think i have a solution which is not so good but it should work.
you can create a custom plugin for your wordpress. sole purpose of that plugin would be fetching data form that db and show it in you wp site.
make a custom connection in your plugin to connect it with the database you want.

Wordpress site - using custom PHP and database

I have finally finished coding a project with an HTML form for file upload, and a large PHP file that submits a 200 field CSV into my database. It first uploads to a staging table and then splits the data into smaller tables.
This all works perfectly but I'm having problems with the next step: This is needed to run on a wordpress site that already exists. I have a database just for this project with tables for users, clients, staging, meters, etc. I need all of these tables in their own database because these users are separate from the WP users.
I found a plugin that allows you to insert PHP into pages, but I need to know how to work with a custom database in WP, I've only ever worked with the actual database. Any help is greatly appreciated.
Include wordpress db file in your script 'wp-admin/includes/upgrade.php' and then call
global $wpdb;
$wpdb->query($your_query_string);
This way you can use wordpress database. But go through wordpress once so you will be aware of tables. Because wordpress save specific data to specific tables, say - any informartion about user to user_meta table.
If you are trying to insert new users then you may need to enter data into user table.
Another method is there.
You can open your wordpress theme's function.php then you can write scripts to enter your data or what ever fuctionality you are looking for. And I think that is a better way to work with wordpress.
If you want to use php, try this tutorial: https://www.w3schools.com/php/php_ref_mysqli.asp
If you are developing wordpress plugins check out the wordpress codex: https://codex.wordpress.org/Creating_Tables_with_Plugins
This is going to take a bit of research on your part. Good luck!

populate Wordpress page/post from external db - on the fly

After providing an event calender with PHP/MySQL/HTML/CSS I want to use Wordpress for that project from now on. Account and data management will remain outside of wordpress scope.
My best idea so far is to populate the posts (or pages) entirely from the already existing db. The URLs would be created by apache's rewrite engine.
To use one post and populate just the content would lead to really bad SEO.
So I want to create (virtually) unique posts populated entirely from the db. Extensive research on that topic brought up nothing usable so far. Maybe someone could point me in the right direction?
Preferences:
using mod rewrite to create the pages urls from event /ID/title rather than using the timestamps to create posts
keeping the data editable via external admin panel (no copying into WP-DB)
head data of post / page must be populated from db, e.g. title, author, timestamp etc.
Suggestions would be much appreciated, thanks in advance.
Have you tried the plugin WP All import. It creates unique post such are car listing etc based on the external DB. I also allows you to style and format your post.
https://wordpress.org/plugins/wp-all-import/

Wordpress plugin to automate posts being generated based on backend tables?

I am a long time Wordpress user looking to use the tool as a CMS to generate a website which will have individual posts about hundreds of specs on products that I have stored in a backend MySQL table. Is there a plugin or a tool that will help me auto generate these posts? For each post, I would like it to have the same format of title (one column) so that the URL will look like: http://www.domain.com/product1specs etc. Each post will contain a description (another column) and show a graph (data stored in another column).
Or do I even need to create posts? Is there a way to do this dynamically? So if someone goes to www.domain.com/product1 than it will automatically look in the database to find out what it should display for product1?
I believe there are other ways to do this with an PHP framework such as Code Igniter but I would like to stick with Wordpress because I am familiar with it and have other Wordpress plugins/themes I would like to leverage.
Any tips would be greatly appreciated!
I don't know of a plugin but take a look at this answer which basically required the same thing:
How to migrate from Yii to Woocommerce Wp, Still keep to old database (table,rows)

Moving data from custom blog to Wordpress?

Ok so i have this custom blog that i now need to move over to wordpress. I tried using the import features in wordpress but that didnt work as planned. The custom blog is written in php and has a userscomments table, authors table, and posts table. Is there an easy way to move all these posts over to wordpress and preserve all the comments per post.
If the custom blog doesn't have an export function that will dump its data into a format WordPress can read, then it may be that you'll have to roll your own. There are 2 approaches:
Do a database-only import, using code or SQL tools along with information from the WordPress Codex entry on the WP database. This will probably be fairly simple from a coding standpoint, but you have to make sure you get it right.
Use the WordPress API to create the posts based on the output from the old system. This will involve a bit more learning, but it's the Right Way™ to do it, and means that you learn the WordPress API rather than the database structure.
If I were doing it myself, I'd choose option #2.

Categories