Tag Info

New answers tagged

0

After some hard work and research, I finally came up with this working solution. Please feel free to improve on this code and post an alternative answer. For some reason, the query seems to be running more than once (three to four times in my case). Here, I am making use of three hooks, posts_search, posts_join and posts_groupby Function ...


0

Try this : $value = get_post_custom_values( 'banda_postmeta', $post->ID ); $value = unserialize("$value"); print_r($value); echo $value['social_networks_url']['twitter_url']; Your social_networks_url are blank, so try echoing these values, it will echo the value. echo $value['page_builder_settings']."<br />"; echo ...


-3

SELECT ID, post_title, guid FROM posts WHERE post_type='product' and post_status='publish' and ID IN( SELECT object_id FROM term_relationships WHERE term_taxonomy_id ...


0

You're including the table prefix, but $wpdb takes care of that. Change: $query = $wpdb->prepare( "SELECT * FROM $wpdb->wp_terms INNER JOIN $wpdb->wp_term_taxonomy ON ($wpdb->wp_terms.term_id = $wpdb->wp_term_taxonomy.term_id) WHERE $wpdb->wp_terms.name LIKE %s AND $wpdb->wp_terms.count > 0", $wpdb->esc_like($keyword) . '%'); ...


0

Use stripslashes to remove the slashes. For example: echo stripslashes( $field );


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

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'


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

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


0

You can install this plugin, Debug Bar, it is not only query, you can also debug more information.


0

A good pointer would be to enable debugging in WordPress. Add this to your wp-config.php: define( 'WP_DEBUG', true );. By default WordPress does not show much debug information. More on this here.


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


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


0

This seems to be a problem with "orphaned SELECT statements". It is described here in more detail. One solution would be to create a temporary table and modify my_acquireuserpasswd to save data to temp_table BEGIN DECLARE passwdtemp VARCHAR(64); DECLARE temp VARCHAR(4000); START TRANSACTION; SELECT id, passwd INTO uid1, passwdtemp FROM users ...


0

For copying a site to a new location. use --add-drop-table during export, if you're importing to an empty database. omit --add-drop-table during export, if you're importing to merge the database. Remember to update wp_options after import each time, since path is different. Also, update the .htaccess file with new path.



Top 50 recent answers are included