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
- 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?
- importing third party json feed as custom post type [closed]
- how to get posts by custom post type then display Custom fields?
- Filtering a WP_Query meta_query by numeric values isn’t working
- Populate a ACF Select Dropdown from Custom Post Type
- Display related post content and custom field content
- How can I save a Custom Post Title and Slug with a Custom Field?
- WordPress page not showing up – replaced with last 10 posts?
- Custom permalink rewrite rules – how do I fix this?
- Custom Field as Custom Post type element class
- Extracting Post ID and passing through as an attribute in a shortcode
- 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
- Populate custom post type/custom fields from an external database
- Fixed custom fields depending on posttype/category
- Automatically convert standard posts with custom fields to custom post types
- Showing custom post user wise with different color in wordpress
- Submit and edit font end custom post type
- Group/list/sort custom post type posts by date in tabs from acf datepicker field
- How to make a custom search template for custom taxonomy?
- Making my custom column sortable
- Grouping and paging CPT events by month with custom field date
- Can’t pick up a field created with Advanced Custom Fields
- 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
- Custom post tag images not displaying with ACF
- Filter Content on all Post Types
- Get month and day from a Date Picker custom field
- Advanced Custom Fields – Add Field to Specific Page [closed]
- How to query posts by meta keys AND under specific category?
- $post breaking container loop
- using ACF datepicker to filter posts on a page
- Get post id of permalink for a specific custom post type?
- 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
- Collection of fields in a single post
- Modifying and Displaying URL’s in a Post Template using parse_url
- If you’re calling a dynamic css inline style does that div have to be in the loop?
- How to query the content of a specific custom post type?
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Custom post type adding additional markup
- Advanced Custom Fields: query posts filtered by multiple field values
- Copying custom field value in to title
- Custom Post-type not returning the right child_of
- Problem with a query in custom posts
- Filtering problem
- Multiple while loops not functioning [closed]
- How to show animal lineage/pedigree in WordPress?
- Custom Post Type Loop breaking php
- Register a title automatically with a relationship field
- Styling first post using Advanced Custom Fields
- WooCommerce – Complete Order when an action occurs
- ACF – Query relationship without ID
- ACF Relationship: Group posts by parent category term, then child [closed]
- ACF Field to set Publish Date – Post Duplication upon Update
- Getting ACF relationship field information
- 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
- How to I add count of custom posts listed in a post as a prefix to its title
- Is it possible to specify a time interval (from, to) in ACF with date picker, or other custom field?
- Why custom search engine only searches in post titles of custom posts?
- Filter page ID outside the loop and order
- Elementor Custom Query to get Posts by ACF (Post Object Field
- Display ACF object field data using Elementor Custom Query
- Assign a tag to custom post type using a query
- Custom taxonomy meta fields
- Create WP multisites as a custom post type
- WordPress WP_Query Sort by 2 dates – custom fields
- Post object GUID adding http:/
- Two custom post type relations
- Custom Sort Order for Custom Post Type Taxonomy
- Display custom post type attached media file sizes
- selecting custom post types and taxonomies for hub page listing blocks
- WordPress post objects in one parent post object
- Meta query with ACF relationship field
- Made a Custom Post Type using ACF. Via the dashboard I cannot see the view button to see the post
- Creating a Single Instance Custom Post Type with Limited Module Options using ACF and WPGraphQL
- Code output help please! WordPress> ACF > Relationship > Post Object
- ACF Pro simple Business Directory – Requesting assistance with created Templates and associated Functions.php Coding
- How can I filter records in a custom post type list in the admin based on the ACF field in the post that contains the current user?
- WordPress custom post type -> query and sort by custom field with multiple values, then published date
- WordPress duplicating posts from single loop
- Use Custom Field to Display Post Loop
- Query custom fields with three dates – start and end does not work
- Custom fields disappearing when a custom post type is assigned
- How to automatically update ACF field value every year?
- displaying ACF Repeater Fields in Backend sorted by a subfield
- Advanced Custom Fields Custom Post Types Heirarchy
- Generate Post Title From ACF Fields on Custom Post Type
- How do I add a filter to my custom post type archive page?
- How to Dynamically Filter Custom Post Types by Taxonomy Based on URL in Elementor Pro and ACF?
- ACF – Updating all posts of CPT when a custom field from options page is updated