Wordpress and plugins (inventor) where posts table is defined - wordpress

I need to make some work with wordpress 4.9. The table prefix is defined as abc_ and some posts is exists in table abc_posts. But also tables abc_2_posts and abc_3_posts is exists. Site catalog is actually rendered from abc_2_posts. Where this is configured?

This is because you are using a multisite installation. Every site in the network will have a unique id assigned to it. Looking at the table name abc_2_posts the number 2 tells you that this table is used by the site with id 2.

Related

How do we reset the blog_id count in a WordPress Multisite

I've just cloned all my subsites (40) from one Multisite to another of my Multisite installations. I want to use this opportunity to clean-up/reset the blog counter in my old MU to start at 2 again. Currently the blog counter is at 64 even though i only had 40 subsites. I know its like a primary-key in the db and auto increments with every new subsite created. With all my deletions and tinkerings over the months its left lots of gaps in the indexing numbers. I've found the column 'blog_count' in the wp_sitemeta Db table in MySQL and it currently stands at 40, correctly but i can't believe its the only place that the count exists and don't want to risk mucking about with it. Could it be safely altered??
The next sub-site of the multisite is defined by the AUTO_INCREMENT value of the wp_blogs DB table. It defines the next blog_id primary key. We can find AUTO_INCREMENT in the Operations tab of the table in the phpMyAdmin. But we can't change it to less number than used in the table.
But we can export the wp_blogs table, change it with Notepad++, then delete the table and import the changed table. Actually, I guess we can do it with the whole DB and replace any wp_{old_index}_ to wp_{new_index}_.
The example.
Let's imagine we have sub-sites from index 7 and more. These are steps for changing wp_7_{tables} to wp_2_{tables} (it's the first after the root site):
Make a full backup.:)
Remove all unnecessary sites (for example
wp_8_, etc.). Remove tables with old prefixes too.
Use the Search tab and change all DB fields with wp_7_{filedname} to
wp_2_{filedname}. Because there are some important site's metas with field starting with wp_{n}_{fieldname}.
On the Operation tab rename all DB tables with wp_7_{tablename}
to wp_2_{tablename}.
Change the wp_blogs table increment to 3 (it's next after 2): export the table in the phpMyAdmin, edit it, delete the original, and import the changed table back. The table is small it will easy.
Done. Add the next site with index 3.

How to replace multiple urls to one specific url at once?

In wordpress database We have these thumbs as url links:
1st example:
http://thumb-v.xhcdn.com/t/170/1_6933170.jpg
2nd example:
https://thumb-v.xhcdn.com/t/325/200/3_8168325.jpg
Others are similar. There are over 2000+ urls are exist in the database like above. However the entire database have 15000 urls different than these urls. So I don't want to change all of them just the above structured ones.
I'd like to change/replace these multiple urls with one specific url like this:
http://example.com/lockedthumb.jpg
How to do this? By excel? Or is there any useful wordpress plugin?
As you can see multiple & different urls are starting with this: http://thumb-v.xhcdn.com/t/ or https version. But the rest of it has different numbered folders and jpg filenames.
You can try this in SQL :
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://thumb-v.xhcdn.com/t/170/1_6933170.jpg', 'http://example.com/lockedthumb.jpg');
You have to edit the table name and the field where are saved the data you search.
Best regards

Possible to add two authors with same name, using Co-Authors Plus in WordPress?

Working on a large content base in WordPress, with the Co-Authors Plus plug-in installed. Several thousand authors. A new author needs to be added using the Guest Author functionality provided by the Co-Authors Plus plugin for WordPress, already enabled and successfully in use in our theme.
The new author wants his name spelled exactly as an existing author with the same name. Attempting to create the author record results in an error, wherein the plugin balks at the duplicate.
We only care about the Display Name - the slugs can be different, even have a number on the end. However, we can't use different fields than we already do, because we can't make the case for changing the front-end code just based on this error/case.
Has anyone had any luck with this, whether through a straightforward and sensible change in the plugin, a different method of data entry, or anything that's not too... "hackish"?
Been tinkering on and off for a couple days and arrived at a solution, although it's not ideal, that allows me to end up with multiple authors that have the same name.
In short, WordPress wants the new author's slug to be different than the first. Once that criterion is met and the record has been created, it appears I can do whatever I want with the Display Name on subsequent edits. The slug is generated automatically from the Display Name when the Guest Author record is created, so the trick is, well, to trick WordPress temporarily.
I followed these steps:
Choose a Display Name for the new author that will result in the creation of a slug you find acceptable. For example, if the original author's Display Name is John Smith (with a slug of john-smith), I used John Smith 2 as the Display Name for the new author.
Save the new author - in my example, the slug created upon saving was john-smith-2.
Now the new author can be edited - I changed the author's Display Name back to John Smith and saved without a problem or error.
Note that the slug, once created, cannot easily be changed, and in my case remained john-smith-2 - so make sure when you're creating the new author with the same name as an existing one that the slug that will be created from the temporary Display Name is something you can live with and, if possible, fits a pattern or system that you can use if you encounter this problem again in the future.

Drupal to Wordpress - Migrating Comments

I have a Drupal 6.25 database that I'm trying to migrate to Wordpress (v3.4.1). I'm able to copy the content into Wordpress, but when it comes to comments, I seem to have trouble with converting the thread column (in Drupal comments table) to comment_parent (in Wordpress wp_comments).
Here's the code that I'm using (taken from a tutorial):
INSERT INTO `mywordpress`.wp_comments
(comment_post_ID, comment_date, comment_content, comment_parent, comment_author,
comment_author_email, comment_author_url, comment_approved)
SELECT DISTINCT
nid, FROM_UNIXTIME(timestamp), comment, thread, name,
mail, homepage, ((status + 1) % 2)
FROM mydrupal.comments;
The above doesn't work since Wordpress comment_parent is a BIGINT type while the Drupal thread column is a VARCHAR, with values such as 0a.01.03.00/,
How can these be transformed into Wordpress compatible values?
You can try this query (I've taken it from this tutorial):
UPDATE IGNORE wordpress.wp_term_relationships, wordpress.wp_term_taxonomy
SET wordpress.wp_term_relationships.term_taxonomy_id = wordpress.wp_term_taxonomy.term_taxonomy_id
WHERE wordpress.wp_term_relationships.term_taxonomy_id = wordpress.wp_term_taxonomy.term_id

Changing the Admin Theme in Drupal 6 Directly in Database

I'd like to restore the default admin theme in Drupal 6 via the database. Anyone know where this is stored?
Btw, there is a great answer describing how to change your site's public theme in the database here ...I just could not get it to update my admin theme.
List of themes you can find in {system} table, filter by type = theme, there you can set status = 1
Default theme you can find in {variable} table, filter by name = theme_default, change it to you theme name, as it is written in system table (for example, garland, not Garland).
After this clear cache table.
Follow these steps via the db:
{system} table, filter by type=theme
set status=1
{variable} table, filter by
name=theme_default change it to you
theme name, as it is written in
system table
{variable} table, filter by
name=admin_theme change it to you
theme name, as it is written in
system table. Do not skip this step.
truncate cache
Login to your phpMyAdmin, click on SQL tab and run:
UPDATE system SET status=1 WHERE name = 'garland';
UPDATE variable SET value='s:7:"garland"' WHERE name = 'theme_default';
TRUNCATE cache;
Note that you may need to add prefix to your tables
Thanks to https://drupal.org/node/200774
If you're editing the variables in PHPMyAdmin, remember that you're editing a serialized value. This means that the value you're editing looks something like this: 's:7:"garland"'.
If you just changed "garland" to "marvin" that would change the number of letters in the serialized value from seven to six.
You'd need to change 's:7:"garland"' to 's:6:"marvin"'
That is, you'd need to count the number of letters in your new theme, and update the number following s: accordingly.

Resources