Quantcast
Channel: Question and Answer » wpdb
Browsing latest articles
Browse All 44 View Live

Does WordPress $wpdb functions wait when table is locked?

Does WordPress’ $wpdb functions wait when the table is locked? For example Function A() uses $wpdb->getresults. When $wpdb->getresults wants to read a table and its locked, does it wait for...

View Article



WPDB Multiple site's posts and get featured images

I am using the code below to query 5 WordPress sites for their posts, merging them into an array, sorting the array by date, and then displaying them: //SITE 1 $mydb = new...

View Article

Include post_status check within $wpdb query

I’ve got a function that returns a count from the database for publish posts that match the product ID to the post meta ID (both are the product type). I’ve realized this query returns unpublished...

View Article

wpdb get_row database query inquiry

Is this the right way to use get_row with a select *? $_crds = $wpdb->get_row($wpdb->prepare(" SELECT * FROM `mailers` WHERE `id` = %d", $_GET['caId'] )); $_zipcodes = $_crds->zipcodes;...

View Article

WordPress wpdb->insert returns int(0) => doesn't insert anything, no errors!

I am really clueless. I want to do an insertion in my WordPress plugin the problem is it doesn’t return any errors nor it insert the stuff! I don’t know how to fix this and really need your help. In...

View Article


Get users within a latitude / longitude radius, based on custom fields

I’ve create two custom fields for my users: latitude longitude Here’s my code. I think I’m close: $user_query = $wpdb->get_results( " SELECT u.ID, u.user_login, latitude.meta_value,...

View Article

Why Do I Still Getting Duplicate Rows in SQL?

I’m creating a Custom Freight System which stores the order and the products requested by the user into the WordPress Database. The Problem When I insert the product into the wp_my_custom_products...

View Article

How To Use WP_Query To Get The Custom Post type Posts With Keywords

I want to query with keywords and display some related posts on custom taxonomy page, the related posts comes from a custom post type “gift”. I have tried the code below, but it only worked for default...

View Article


Cannot access the thumbnails of attachment images… Cannot find the reason

I have a custom form that allows users to make posts and also upload images with it. The images are saved in wp_posts as post_type = attachment with a guid to show the image. Now I have created a grid...

View Article


$wpdb->last_error deosn't show the query on error

I am inserting data in the custom table using the $wpdb->insert. However, upon error I don’t seem to get any information from $wpdb->last_error. What could be the cause of this? I already have...

View Article
Browsing latest articles
Browse All 44 View Live


Latest Images