Articles of database

Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin

I have a wordpress table like so (phpmyadmin and MySQL) | id | meta_key | meta_value | +—-+———–+————+ | 1 | import_id | abc | | 2 | import_id | abc | | 3 | import_id | def | | 4 | import_id | xyz | | 5 | import_id | xyz | | 6 […]

Subscribers to posts

Consider each post to be topic of conversation, and comments a conversation. For now it is fine. I created a post type called conversation. Now I want to list all the conversations a user is in. How can I extend wordpress for this functionality? In my idea was to create a new table called wp_posts_users […]

Is a direct or import approach safer for migration into WordPress?

We’re in the process of migrating a site from an existing CMS system into WordPress. The existing CMS system has no direct integration tools with WordPress. I’m looking into the option of creating my own script/application that will migrate the content between the two systems. Would it be better to migrate directly into the database […]

Is there a naming convention for database tables created by a plugin?

I have setup my plugin’s table to use $wpdb->prefix but aside from that are there any conventions that you should name them; Maybe $wpdb->prefix.’plugin_’.$tablename or something. I can’t find any documentation and the examples of plugins I have used in the past don’t seem to adhere to anything in particular.

Error connecting to DB in /wp-includes/wp-db.php on line 1538

new in wordpress world. My wordpress page keeps failing. It works from time to time, meaning refreshing sometimes offer the page, others it offers the Error establishing a database connection page. Checking the wp-content/debug.log it says: PHP Warning: mysqli_real_connect(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /www/wp-includes/wp-db.php on line 1538 As far as […]

How to use custom post type APIs, but use a different db table

We currently have a plugin that creates a new WP table, but it recreates the wheel when it comes to managing/updating data. It would be a good candidate for custom post types, but we don’t want to pollute the wp_posts table. Use case: We’re creating a specific job board for a company that lists 100s […]

migrate comments from old database to new database

I recently created a new WP site with some of the same content from my old WP site. Is there a way to migrate comments from my old database to me new database? i tried importing old the wp_comments table into my new db via phpmysql. They did import and appeared in my wp admin, […]

Widget queries even when there are no sidebars?

I’m trying to reduce my database queries. I don’t have any sidebars or widgets set but I noticed the following query SELECT option_value FROM wp_options WHERE option_name = ‘widget_pages’ LIMIT 1 Similar queries happen for widget_calendar, widget_links, widget_tag_cloud, and widget_nav_menu. 5 database queries for no reason. How do I disable this? remove_action(‘widgets_init’) doesn’t do anything.

Database slowdown after update to 3.4.1

I own a wordpress installation, and Updated to 3.4.1. After the upgrade, I got a very strange slowdown to my wordpress. After all, I used the define(‘SAVEQUERIES’, true); in my wp-config.php with combined with the following code in my theme footer.php global $wpdb; echo “<pre>”; print_r($wpdb->queries); echo “</pre>”; and I found that while I don’t […]

WordPress database becoming huge. How to analyze and optimize it? fear of running out of memory

look at the size of my wordpress database tables: are there simple ways to optimize it? I fear of running out of memory one day maybe bad collation? how can I analyze what is eating up so much space in the posts and post meta tables?