Okay, I figured it out:
global $wpdb;
$par_order = $reservation->transaction_id;
$store = wp_get_current_user();
$store_id = $store->ID;
$sql = "SELECT ID FROM $wpdb->posts WHERE post_type="shop_order" AND post_parent = $par_order AND post_author = $store_id";
$sub_orders = $wpdb->get_var($wpdb->prepare($sql,$seller_id));
thank you @czerspalace for the clue
Related Posts:
- How to parse row results from $wpdb -> get_results
- Why $wpdb->show_errors() and print_error() is showing an output even if the query output is correct?
- How do I check for a duplicate record before inserting using wpdb
- $wpdb->insert not working in any way
- get_results on large datasets
- $wpdb->insert() and Values for Datetime Columns?
- Change post status based on meta value
- wpdb->insert not working
- Speed optimization of $wpdb->get_results
- How do I create a single.php for a specific category?
- $wpdb is get_results escaped
- Using $wpdb generates DB error
- How do you use prepare when asking for a list of id’s
- How to get top 10 user is based on user meta value
- wpdb prepare: passing varible number of fields as second argument
- $wpdb insert array
- Wpdb query for comment meta for current post
- How to update records using $wpdb?
- How to Modify this $wpdb query to accept an array of post statuses
- How to prevent $wpdb->prepare stripping a leading zero in variable value?
- Generate a unique hash/number for tracking on $wpdb insert
- show badge with count for pending items in custom post type
- WPDB Update using Conditional Arrays
- $wpdb->get_results returns empty but value exists
- WP Sql query multiple where clause
- Problem displaying inserted form
- Get published posts and pages?
- create drop down menu in theme customizer from custom db
- Are there risks associated with using wp_options table using wpdb to update theme options
- Syntax for $wpdb->prepare when searching in two columns
- $wpdb->insert is running multiple times on page load, but only called once
- Get an array of meta_values for a user meta_key
- WPDB – How to search a column in a table
- Confused by $wpdb->prepare
- How to get a value-only flat array from $wpdb->get_results when selecting a single column, without foreach()?
- How to Instantiate wpdb Object in New File
- How do you build a wpdb query dynamically?
- Would this WPDB setup result in potential race conditions?
- How to update a row in a table in WordPress
- WordPress (on AWS ubuntu) database Fails “Connection refused in .. /wp-includes/wp-db.php on line 1531”
- Optimizing WordPress Queries – Removing Group By ID
- External DB Connection [closed]
- How to get entry by title by using wpdb
- Codex: Database Description: meaning of Cardinality
- WordPress is trimming leading 0s
- WordPress db prepare
- get_results not returning anything
- how to get db values without using an loop with wpdb->get_results()
- How to left join meta in queries [closed]
- How to run wp_insert_post() & wpdb on the background?
- Trying to get variable from WP table and toggle its value
- Set MySQL variables in WPDB
- get_results query with accent
- Save data from a checkbox to a wpdb array
- How to prepare an array of values with $wpdb
- Is querying wpdb directly and skipping actions provided by WP’s core “wp_update_post” a good idea?
- WP-PostRatings: list current user’s rated posts
- $wpdb query outputs php code instead of executing it
- WPDB Join with custom table
- Getting values from wpdb
- Using “->” in a page to exceute $wpdb query gives error
- Why is this $wpdb query looping 5 times?
- wpdb query not returning results containing single quotes
- duplicate entries in database while using save_post or wp_insert_post
- WPDB Table Does Not Exist
- Unknown column ‘siteurl’ in ‘where clause’ WPDB outside
- Exclude specific terms from all queries using posts_where or something similar
- query a newly created table using $wpdb
- Get all sticky posts from one user through user ID
- $wpdb->get_results(…) with $wpdb->prepare(…) returns empty array despite correct query
- wpdb insert formatting for date in array
- how to list all post that are in the custom taxonomy using $wpdb
- Access to numerically indexed array in wpdb Class and undefined offset
- “This message was added in version X” showing a later version than current one
- Prepare WPDB with meta key and meta value
- How to get row value from wpdb
- I am using wpdb but it not working perfectly.but if I dont use form data its work
- Escaping a WPDB Object in One Shot
- wont add form details to database or send me mail
- Create a stored procedure on plugin activation
- Creating an Angular factory from custom database table
- How do I update post based on meta_key in another table?
- Object Cache – Avoid db queries totally
- Custom database query to validate data
- Creates only one table and not the other
- Update all fields of table with ON DUPLICATE KEY UPDATE command
- WordPress – wpdb query does not list same result as sql query
- What is the best practice to initialise $wpdb by loading wp-load.php?
- $wpdb->get_results in not an array
- adding a log row log table, when the draft post publish
- How to make iteration on wpdb->update or query statement?
- looking for a way to allow users to backup the plugin db data(save as)
- wp-postratings: list current user’s unrated posts
- Jeditable Plugin working as it should – scope issue?
- Out of Memory – Line 791 of WP-DB.php (mysql_real_escape_string)
- Site going down due to slow queries
- Call to a member function get_results() on a non-object in wordpress plugin
- How do I change the datetime format from ( ‘y-m-d’ ) to ( ‘d m y’ ) [closed]
- query_vars doesn’t return query string (trying to get data from $wpdb)
- $wpdb->prepare UPDATE process not work in functions.php