Articles of database

Can I have multiple database users within WordPress?

I want to use more than one database user to overcome the 7500 query database limit. How can I do that using wp-config.php? I want all the users to have the same password.

wpdb custom post_type problem

I want to use custom post type in my custom SQL query, but, when I add the custom post type im my query, I get no results. Where’s my probelm ? This is the code I’ve tried $top5_ov_performance = $wpdb->get_results(“SELECT post_id,meta_value FROM “.$wpdb->prefix.”postmeta WHERE meta_key = ‘sd_top5_overclocing’ AND (post_type = ‘cpu’) ORDER BY meta_value DESC […]

Unusable menus and “Illegal widget setting ID: nav_menu_item” error

This is a bug in my WP install that has crept up unknowingly; I can’t say for sure when it began. To describe it: there were menus created in the Appearance -> Menus page early in the site’s history, and they work perfectly, as in: They have menu items They can be assigned to menu […]

What happens if I overwrite the current wp_options table with a backup from a week ago?

I have a rather silly situation. I tried this query UPDATE wp_options SET option_value = ‘a:0:{}’ WHERE option_name = ‘active_plugins’; which disabled all my plugins. I was testing some issues on my site and this was the only solution to disable them. I had no wp admin access. The problem is that after I add […]

Get the post permalink within the loop but without additional DB query

I am looking to create a custom ‘directory’ page which will link to several thousands of posts. Because of the large number I am trying to limit the number of DB queries. I notice that to link to each post, I am calling get_permalink() and this is creating an extra DB query for each post. […]

What is the purpose of the option name hack_file in the options table?

I was looking at the options table in a WordPress install and noticed an option name hack_file. At first I thought the site was compromised and then realized it is a default option http://codex.wordpress.org/Option_Reference . I couldn’t find much information regarding it. What is it and its purpose?

Organizing WP Pages based on old website database

I’m moving existing data involving paintings from an old host that didn’t use WordPress to a new host that does. With the old site, data was stored in a database so that each painting had its own page with information (artist, name, year, style, etc) and media pertaining to it, and the pages could then […]

Get all posts that do not have a specific custom field without using a subquery

I need to get all posts that do not have a particular custom field, (e.g. custom_field). The following query works fine: SELECT * FROM wp_posts WHERE ID NOT IN (SELECT post_id FROM wp_postmeta WHERE meta_key = “custom_field”) I try to avoid using subqueries if possible. How can this query be rewritten so it doesn’t use […]

Store and Work with huge array in WP

I need to get all terms that have post with dates in custom field. So I need a list for all dates from the term. I need to know exactly what is tha dates within each term in my site. It’s not in term, it’s in their posts. after that I need to know foreach […]

Show last modified date of database

Is it possible to get timestamp of last change to database? The date should reflect any change – create, update, delete – and any table – posts, comments, post_meta, attachments, etc. I’ve found some related questions, but all of them target only specific tables, such as Show last time WordPress site was updated / modified, […]