What is faster: custom taxonomy or serialized post-meta for db retrieval? (over 60,000 posts)
What is faster: custom taxonomy or serialized post-meta for db retrieval? (over 60,000 posts)
What is faster: custom taxonomy or serialized post-meta for db retrieval? (over 60,000 posts)
$price = $wpdb->get_row($wpdb->prepare(“SELECT salePrice FROM ‘ . $wpdb->gm_ads_products . ‘ WHERE post_id = ‘ . $post->ID . ‘”)); // this seems to be the issue Yes, that’s right. First, because $wpdb->prepare() requires at least two parameters, one is the SQL query with placeholders like %d (for numbers) and the other is the replacement values that … Read more
Getting post revision and printing them on the post content site
$wpdb->update with multiple parameters gives error
I solved it by creating 2 different wp query and then merging them. I also excluded the post ids of 1st query in 2 query to avoid duplicate items.
Creating mySQL procedure with $wpdb
Yes, there is. If you want to retrieve just one column from the database table, i.e. all row values for that column, you can use wpdb::get_col(). $values = $wpdb->get_col( “SELECT field FROM {$wpdb->prefix}table” ); foreach ( $values as $value ) { // your code }
You won’t get a proper sort on the meta_value column because the values stored there aren’t treated as integer values, but you can use a method similar to how it was done it WordPress back when we were using meta_value_num to do sorting, which basically involved adding a number onto the front of the data. … Read more
The best solution is to create a custom XML page template in the exact format you need. If you look at the code below taken from the WordPress XML exporter you can see that the data it returns contains the normal stuff we see in a typical WordPress loop. echo ‘<?xml version=”1.0″ encoding=”‘ . get_bloginfo(‘charset’) … Read more
The Problem $my_posts doesn’t contain any posts. It contains post IDs and likes. And you’re dropping both into post__in, which can’t work. I guess even the number of posts wouldn’t work if the plugin(?) wouldn’t add any post with a 0-x integer to the db-table per default. The Debug Try the following: $my_likes = $wpdb->get_col(“SELECT … Read more