Thanks for your help s_ha_dum,
I had a look at the table structure using phpMyAdmin,
ACF Plugin saves fields to the postmeta table, so sb_wpsc_meta needed to be changed to sb_postmeta. also needed to change what was being SELECT to post_id aswell as the meta_value to 1.
final query;
"SELECT post_id FROM sb_postmeta WHERE `meta_key` = 'product_discount_option' AND meta_value = 1"
Related Posts:
- Filter by custom field in custom post type on admin page
- Filtering a WP_Query meta_query by numeric values isn’t working
- Populate a ACF Select Dropdown from Custom Post Type
- Filter a custom field based on selection of another custom field (ACF) [closed]
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- Meta Query “IN” doesn’t work with ACF checkbox filter
- Retrieve a specific field from taxonomy term through advanced custom fields [closed]
- Count custom post types with a specific meta value
- How do I write this SQL statement for Posts written in last 24 hours?
- Change message given when deleting post from custom post type
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Display posts if a custom field value is equal to another custom field value
- ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
- Query to change custom post type with specific category
- Calculating Bayesian average for custom post type
- Query Custom Post Types by date (custom field) range
- ACF simple text field value not showing
- Post Object Filter by Custom Field, not title (ACF)
- Rewrite WordPress URL to show CPT meta field data
- Custom Post type and Custom Field WP_Query
- Display multiple custom post types and sort them chronological by one of their fields
- Adding custom tables to WordPress
- Multiple ACF Repeaters within a Custom Post Type
- How to change post featured image using a custom field of category?
- Custom fields vs. Custom post types for a Portfolio Website
- Add custom ID to CPT posts only create not update
- WP_Query order by custom field, then randomly order some of results
- How to render a custom post type template with custom fields using shortcode
- How to query WordPress posts bycustom field with a max characters’ length
- Function causing the loop display posting more (empty)
- The loop seems stuck to a single (now deleted) post
- Custom Post Types vs. Advanced Custom Fields (with Repeater Field add-on)
- Specific routing for CPT
- How To Import CPT With Only Few TEXT ACF Fields From Front End?
- Advanced custom field boolean value in custom post type
- Why would social icon badges disappear after adding a custom post type?
- ACF repeater field usage
- Navigate posts with different post type that are in the same categories
- List of users that clicked a ‘Join’ button at single post
- set_query_params using custom params defined in functions file?
- Custome fields not displayed
- How to define the template for custom posts?
- Batch Extract Date from post title and put into ACF custom field
- Query entries from custom post type in an ACF flexible content field
- How do I get_the_postID() for a custom post that uses ACF repeater field?
- How to export custom post type with ACF to individual file with automation?
- Custom post types, disable fields
- ACF Relationship Posts how to show additional content
- Limit search field to just search a custom post type with custom fields
- $wpdb is queried but results don’t show
- Having a repeating custom field in admin custom post type, what I’d go better with, for DB’s sake? ACF repeater or query a different post type?
- How can i show ACF in post excerpts
- Fetch data of 2 relational Custom Post in WordPress
- count & sum the value of custom field of the author post in dynamic posts
- Grouping custom wordpress post types by acf value
- Set Post Private if no linked Post Objects (ACF)
- Show in an entry a Custom Post Type associated to a post
- Orderby custom fields is not working
- Display a Custom Post Type with Advanced Custom Fields on Homepage
- Filter result of Custom Post Type using meta_query with ACF
- How to display posts with plugin (advanced custom fields) field groups?
- WordPress – display relationship between blog posts and custom posts
- Same custom post type with different ACF
- Custom sorting in post columns by ACF Pro Select Field
- Load info from customposttype into template page
- Subpages URLs for Custom Post Type
- Custom post type not pulling CSS
- ACF meta_key and meta_value break loop
- search results to show individual ACF fields from inside custom posts
- Videos Post Type with Custom Filters
- How to show link to product in custom fields?
- In the admin, how can you list thumbnails instead of titles for a custom post type?
- Use output of wp_dropdown_categories($args)
- Looping through image object using ACF and CPT UI [SOLVED]
- Values show up in custom home page but not in custom post pages
- Display related post content and custom field content
- WordPress page not showing up – replaced with last 10 posts?
- Custom permalink rewrite rules – how do I fix this?
- Best way to have one product in both rental and sale parent category
- How do I display specific custom posts, and how do I edit a post’s singular page?
- Post that populates itself (almost) automatically using data from imported excel file
- Showing custom post user wise with different color in wordpress
- Submit and edit font end custom post type
- How to make a custom search template for custom taxonomy?
- How to load custom post type plugin after acf options page (or get settings from there another way)?
- Custom post order when using OR relation
- Filter Content on all Post Types
- Advanced Custom Fields – Add Field to Specific Page [closed]
- $post breaking container loop
- Collection of fields in a single post
- Problem with a query in custom posts
- Multiple while loops not functioning [closed]
- WooCommerce – Complete Order when an action occurs
- WordPress Loop trouble with ACF [closed]
- using a template for more then 1 page
- Create a WordPress Database query to find users who purchased specific product through WooCommerce [closed]
- Retrieve a post with its ACF repeater fields in wordpress
- Good practical way to do loop within loop to show child custom type using a template code
- Two custom post type relations
- selecting custom post types and taxonomies for hub page listing blocks