Under the premise, that your database entries do get saved correctly and your problem occurs on retrieval only:
If multiple boxes had been selected, the values should live in the database as serialized arrays.
Fortunately, get_post_meta
unserializes them for us, but they are still arrays.
Hence, your conditional should be modified like so:
$program_flags = get_post_meta( $post->ID, 'program_flags', true );
if(
'No-marketing-text' === $program_flags
||
( is_array( $program_flags ) && in_array( 'No-marketing-text', $program_flags ) )
){
// do your thing
}
Related Posts:
- How to make number of blog posts a custom field?
- How to display only one category in a custom post type?
- Show a Category Specific Info Box
- How can i retrive the movies, trailers, news in a single page using search
- Where does WordPress store the users customization in the theme
- Add a checkbox to post screen that adds a class to the title
- Publish pending article from front end with a button?
- Attach pdf file to custom post type
- How do I create a featured post within a custom post type?
- Static posts page with home.php
- Delete Post Link to delete post, its meta and attachments
- Add custom field to category of custom post type
- What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
- Add custom fields to post programmatically
- user contributed content as custom post types
- Remove custom posts that match taxonomy value
- Advanced Custom Fields – Storing array value for further usage
- Custom Theme Want To Remove One Category From All Displays
- Filter Posts By Tag
- Post Type Label Name
- wp_query ‘s’ parameter does not work with custom post type
- Accessing post->ID outside of the loop for listing child pages
- Blog Posts in Custom Menu
- How to display data in archive page?
- Set terms in a custom post
- I want to display custom text widgets for each post in the sidebar?
- Display posts styled exactly like default posts
- Move first half of posts to one parent page, second half to the other page
- Custom loop pagination links not working
- Enable Comments Box On Custom Post Type
- wp-cli post create & media import issues
- How can i limit the number of posts created per category?
- Responsive images with custom image size
- Take a received feedback item, turn it into a post
- Admin – create custom post status and display above table
- How do I insert a post with custom post type and relate it to a custom taxonomy?
- Dynamically switch template on click
- “about us”, ” contact” sections should be article(post) or page in the simple small Business website?
- Page template is accessing the incorrect posts?
- Customize rel=canonical tag for single blog post
- disable Tab post on nav-menus page (Admin)
- Tell WP to use a specific template file in posts
- Best Way to Add UnEditable HTML to Posts
- Get post meta retrieving wrong value
- How safe is it to delete old posts edits to save database space?
- Is codex right on deleting post?
- How to get different Related Posts
- Custom home page with full post for first one only
- Update if post with specific title exists
- l accidentally permanently deleted a Draft. There’s any way I can recover it?
- Inserting an example of the last 3 post on to the homepage
- Can WordPress handle following functionalities?
- Get a term each custom post type
- Display message depending on capability outside loop
- Adjust the order for returned posts
- Getting post and attached image from subdomain
- Trying to exclude custom posts based on date, while sorting by custom field
- Help on conditional statement to accompany wp_insert_post function please?
- Alt text attributes not showing over portfolio images
- Adding an option to post editor to show a site disclaimer or message
- Search results for ACF data
- Redirect to custom post if custom archive page has just one result?
- Added a ACF field to custom page and want the results to show as a column in admin
- Template for displaying CPT / Taxonomy URL issues
- Multiple posts in one page
- delete post hook not being fired when deling in wordpress dashboard admin
- WordPress Delete Users from backend doesn’t work
- Is it possible to make a custom post that adds multiple pages?
- Loop through taxonomies and loop through their terms (Newbie question)
- Hiding title of selected post without plugins
- Custom post styling per category?
- Custom post type – Loop out in random order but same 15 to appear first… still random
- Custom post type template not called
- How to use Categories of custom post type
- Static text above category page
- Hook To Get All Posts Deleted
- Meta boxes not saving
- Custom URL Structure for posts with subcategories
- Help with a function that will place a map pin for all posts
- How to show the posts list into a static page? Problems to use the loop into a static page
- Get new post meta data when (custom) post is saved
- How do I control the fallback query after the original query returned cero posts?
- Allow users to create their own page/s
- 404 for some custom taxonomy not ALL taxonomy
- Given two custom post types: Automatically add meta fields from one custom post type to another
- Display metabox with date
- How can I create a menu items from meta box based on users input
- How do I display a full post, not just an excerpt?
- Add default content to post (for specific category)
- get post custom value
- WordPress strips some attributes for author posts
- Automatically delete default posts and pages on theme install?
- Display one post randomly from category on home page
- Deleting first four characters from all Post Titles
- Deleling wordpress posts permanently still have IDs
- get value from post to sidebar
- Post’s arent displaying
- Can I get custom post items in select box (dropdown)
- How to have 2 posting pages on a blog
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields