Tag Info

Hot answers tagged

5

That's a Serialized Array which turns an array into a simple string so that it can be inserted into a database ( since you cannot just insert arrays into a database as they are ). For more information you can read into the PHP docs for serialize() There is also some WordPress functions which do the same: maybe_serialize() and maybe_unserialize(). This ...


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 ...


3

It depends on local factors and actual usage patterns. Bigger queries require more memory to store the data and potentially, depending on the plugins you use, to process it into the response, therefor you are more in a risk of running out of memory. With Bigger response (i.e. bigger page HTML) it takes more time to transfer the page to the browser making the ...


3

If your entire page fits in the 4GB LONGTEXT post content field, the limit to the number of pages would be related to the amount of RAM available on your server. When a multipage post is loaded, it is exploded on <!--nextpage--> to put your post into an array of individual pages, so at that point your single page load is consuming at least twice the ...


3

Your dot and quote notation is funky. Try this: if($wpdb->get_var("SHOW TABLES LIKE '$table_name'" ) != $table_name){ $sql= "CREATE TABLE $table_name ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, email VARCHAR(50), reg_date ...


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() ...


1

Persuming "article_datetime" to be a numeric value, I would suggest that instead of using 'orderby' => 'meta_value' use 'orderby' => 'meta_value_num' If still query is slow, than remove: 'orderby' => 'meta_value', 'meta_key' => 'article_datetime', 'order' => 'DESC' and instead sort the result in php.


1

Try this code. Create a file like "my_db.php" and paste this code: global $table_version; $table_version = "1.0"; function func_table_contactus(){ creat_table_contactus(); } function creat_table_contactus(){ global $wpdb; global $table_version; $table_contactus = $wpdb->prefix."contactus"; $slider_ver = ...


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