Tag Info

Hot answers tagged

4

This answer is the way I would take to solve the issue if I had to face it, it means is not the answer but one of the possibilities. All the operations I will suggest should be run on a development/local server on a backup of database and not on production nor on original database. If you have 26,000 posts but post id like 4,863,166,253 there are zillions ...


2

First off, you should not be handing an untrusted input (in this case, $_GET['id'] to your database. Always SQL-escape the query and validate/sanitize the data. (In the code snippet below, it's SQL-escaped using $wpdb->prepare() for escaping and int typecasting to sanitize to integer value). Secondly, the $wpdb object provides more than just the query() ...


2

In typical use cases the performance cost of booting WordPress core for page load is significantly higher than querying for data. In other words it doesn't quite matter, because it won't be a bottleneck. You have to estimate: How close your data is to native WordPress concepts How much work (if any) it would be required to put it in such representation ...


1

This doesn't have anything to do with WordPress or your user's passwords. What it means is that your MySQL server is still using the old-password-hash mechanism, which was changed in MySQL 4.1. The PHP mysqli client is newer and doesn't support the old password mechanism. Since this causes an error, WordPress falls back to the old mysql client, which does ...


1

Here is my take on things. I have scrapped your complete idea and went with an alternative solution which doesn't use SQL. I have done some testing and found my method to be much faster that the code in your question THE IDEA: You first need to get the current post id, which I get through get_queried_object_id(). The post ID will be used to retrieve: The ...


1

Use WP CLI! First grab the posts you want, we'll use the wp post list command, and we need to run the command in our WordPress directory on the server. Here I'm grabbing all posts in October 2014 on my blog: wp post list --year=2014 --monthnum=10 This gives me ( oh noes my secret draft posts ): ...


1

I have found a way : global $wpdb,$post; $query_ids = $wpdb->get_results("SELECT ID FROM ".$wpdb->prefix."posts WHERE (post_type = 'cpu') LIMIT 0,10"); foreach ($query_ids as $query_id) { $query = ...


1

If you're trying to get all meta values for a key within a specific post type, you can do something like this in a single query: SELECT post_id, meta_value FROM $wpdb->postmeta pm, $wpdb->posts p WHERE meta_key = 'sd_rating' and pm.post_id = p.ID AND p.post_type = 'cpu'



Only top voted, non community-wiki answers of a minimum length are eligible