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:
- Getting custom taxonomy from custom post type
- Media library – Limit images to custom post type
- Filter next_post_link() and previous_post_link() by meta_key?
- Automatically fill custom field value on post publish/update
- Make permalinks based on an ACF-field
- Create Pages from Database
- List events by month
- Use Custom Post Type as Custom Field
- Pull image from ACF field in a Custom Post Type
- Show ACF field from custom taxonomy and display on the single template
- Get Custom Field Values by Another Custom Field in WordPress
- wp_update_post based function works on existing posts, but not new posts
- How to Display ACF Relationship Custom Field as Link to Specific Custom Post?
- Show custom field from custom taxanomy term on custom post type
- How to create an array for a CPT post ID to use in an IF/WHILE statement
- Custom Post type with ACF in REST API, how do I get those values?
- wpdb custom post_type problem
- How to: Display ACF [fields] on Custom Post Types Utilising WordPress ‘Hooks’? [closed]
- Insert post metadata for all posts in CPT at once if metadata no existent
- Convert simple SQL Query to WordPress query
- Problem with WordPress query on page using custom fields
- Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
- WP_Query to select custom post type with Advanced Custom Fields (ACF) date
- Bulk Update Custom Fields for Custom Post Types
- ACF Values Don’t Show After Import Unless I Edit/Update Post
- Troubles with acf/save_post and WP_Query
- Query custom post type with ACF Date
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- CPT archive admin menu label
- Order Custom Post Type by Custom Field Value
- Assign External Database Queries to Global Variables and Make Them Accessible
- Query Custom Post Type Taxonomy term with multiple parameters
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- wp_insert_post sometimes fails after API call
- Order post by date with ACF
- WebP Fallback for Inline Background Image in Style Attribute
- Adavnced custom fields relationship query plus query inside
- Proper way to display latest 5 posts grouped by post type?
- Recoverable Fatal Error – Object of class WP_Post could not be converted to string
- Querying & displaying custom post type into an existent page [closed]
- Custom post type showing same Post on all Pages
- Front end access to a SQL data repository – recommended way?
- Post loop count is not in order
- How to inherit field value from parent post into in child / sub post
- Update post if exist from PHP
- How to use single.php for creating, reading and editing Custom Posts with ACF
- posttype and custom fields on multisite
- Advanced custom fields Post Object image field not displaying in custom post type single.php
- How do I show a link or ‘Read More’ button on a custom field excerpt when it is less than the word limit
- I’m trying to create a custom version of the wp_list_authors function that includes custom post types
- Custom fields not showing in custom post type
- meta query not retrieving posts
- New post from database
- Using WP meta query to show custom post types by a start and finish date
- Convert Custom Taxonomy Posts to Normal Posts
- Advanced custom field – posted fields from custom post type
- Why doesnt my tag page populate with this custom post type?
- How to set a ‘page’ as parent of a custom post type?
- Custom front-end form for adding post – Category problem
- Create/populate Custom Posts ACF fields from external JSON file
- WordPress URL rewrites using Advanced Custom Field
- Custom Post Type and Structure Question
- Query posts by current ACF meta key value on single page as related posts
- Custom post type and custom taxonomy key lenght & query performance
- Show custom post type event if current day using ACF
- How to access repeater field of a custom field?
- Filter posts by their related field’s custom field
- If ACF Post Object post has custom taxonomy term…
- Changing default admin column sorting to an ACF Date Picker field
- Why is this function so slow?
- Permalink URL connection between two custom types
- Sql Update CPT from publish to draft and particular custom field
- Wrapping an unknown amount of posts inside separate HTML Containers during WP_Query loop
- Show specific posts with WP_Query using ACF Post object
- Dropwdown: Get taxonomy terms from posts that share preselected terms from 3 other taxonomies
- Autofill advanced custom field with user data
- Advanced search form with multiple custom fields
- Custom post type option page template
- Some permalinks on Apache/localhost development setup return 404’s when set to anything other than plain permalinks
- How to get a custom post type archive paged when using a custom field for post sorting?
- save_post affect creation and deletion
- Can’t pick up a field created with Advanced Custom Fields
- How to query posts by meta keys AND under specific category?
- using ACF datepicker to filter posts on a page
- how to load custom single.php?
- Setting a custom $query->query_vars[‘meta_key’] breaks the WordPress menu
- Function that get ACF fields value before saving
- How to query the content of a specific custom post type?
- Copying custom field value in to title
- Custom Post-type not returning the right child_of
- Filtering problem
- Register a title automatically with a relationship field
- ACF – Query relationship without ID
- ACF Relationship: Group posts by parent category term, then child [closed]
- Is it possible to specify a time interval (from, to) in ACF with date picker, or other custom field?
- Display ACF object field data using Elementor Custom Query
- Post object GUID adding http:/
- ACF Pro simple Business Directory – Requesting assistance with created Templates and associated Functions.php Coding
- Custom fields disappearing when a custom post type is assigned
- Advanced Custom Fields Custom Post Types Heirarchy