To make this work…
$meta == $item->ID ? ' selected="selected"' : '';
… with an array like a:1:{i:0;s:3:"179";}
which unserializes to…
Array
(
[0] => 179
)
… you’d need to do this:
$meta = unserialize($meta);
$meta[0] == $item->ID ? ' selected="selected"' : '';
But that line shows up inside a foreach
like foreach($meta as $row) {
, at least in one place, so I am wondering why it isn’t written…
$row == $item->ID ? ' selected="selected"' : '';
And the second time that line– $meta[0] == $item->ID ? ' selected="selected"' : ''
— shows up is inside an else
that should not execute unless $meta
is empty, so it shouldn’t using the variable at all.
I’d suggest that you enable debugging and take a good look around.
Related Posts:
- How to select one major category (or custom taxonomy) for a custom post type?
- Why is my select meta data not saving?
- echo selected value from dropdown
- Query a Custom Post Type using SELECT that has ACF fields to compare dates
- Select Menu for Custom post Type does not save
- Advanced search form with filters for custom taxonomies and custom fields
- Help Creating a Slideshow Custom Post Type with Custom Meta Boxes?
- Custom field values deleted when trashing custom post type
- Search multiple custom fields by using meta_query
- Custom Post Type – Taxonomy Dropdown Menu?
- How I check if the same post slug has not been used before publishing?
- How to sort a table of custom posts by column containing custom field
- Issue with saving custom post type when editor is removed
- order by meta_value serialized array
- convert Custom Fields Option-Values to Tags/Taxonomy
- Automatically Insert Custom Field on Custom Post Type Publish
- Display custom post types with custom date field value (before today) & order by custom date field
- How to have the right design for a custom post type without accessing themes
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- WordPress custom meta field for custom post not storing data
- Conditional regex in add_rewrite_rule() for specific query filters & pagination
- How to Duplicate (multiple meta box)?
- List all images from a single post meta value
- Publish an XML feed from a CPT with ACF fields?
- WP_Query: include custom post type only with specific meta value
- Is there a way to get a file URL from the relationship ACF field?
- Want to Add Custom Fields for Uploading video to WordPress Users from front end
- How can I dynamically add a post to a custom post type which uses a custom field?
- Custom Posts Types as Custom Fields
- Random image from tag/custom type on sidebar
- Query & Order posts by custom fields
- retrieve Meta field value from CPT and set those values as Image Meta Field “Title”
- Set a maxlength for the title input in a custom post type
- Update Post Meta for a logged in user
- Problem querying Custom post type by custom fields
- Using custom field content as expression in IF statement [closed]
- ACF From & To Date Validations
- Query Multiple Custom Posts by Custom Fields
- Disable saving posts as draft (make all posts mandatory regardless of the post status)
- Woocommerce custom field search in custom post type [closed]
- Custom REST endpoints for a custom post type with custom fields
- frontend image post uploader
- Custom Post Fields at the beginning of a Custom Permalink
- Possible to filter custom post type with multiple meta data?
- Show fields based on taxonomy selection in editor
- Permalinks: custom structure for taxonomy – tags?
- How to Get the title of a custom field?
- Create custom post with meta field with AJAX and the WordPress REST API
- Specifying meta field’s column type in Database using add_post_meta
- How to customize work area / admin area in a custom post type without plugins?
- ACF in wordpress
- Creating custom post type with custom taxonomy and custom fields programatically
- delete_post_meta() for whole CPT / multiple posts?
- Add “Select All” to custom taxonomy
- How to inherit field value from parent post into in child / sub post
- hide specific div on single.php [closed]
- How do you output an unknown number of images in a custom post type with desired markup?
- posttype and custom fields on multisite
- Custom Fields not showing up for custom post type
- Custom post type in Custom widget – $listItem
- Displaying information from custom field on custom post type
- Add a class to post_class if more than one post shares same meta_value_num
- Add a meta field to the list of results for a custom post type
- Order custom posts by taxonomy, then by meta_key
- Adding a Custom Field to be used by Posts 2 Posts
- Custom fields for post or terms which don’t update on post update
- order the meta query results by 2 custom fields
- ACF – Retrieve custom taxonomy from a relationship field
- how to skip a CPT element from the pager by custom field
- How to Print Title and Permalink of CPT Post behalf of Posts Meta Value with WP_Query
- Query custom post type that has a serialized relational advanced custom field value
- Updating a custom post status after an expiry date rather than trashing it
- How to add dynamic fields on wordpress custom post type page in admin section
- How can I add a meta[] to my custom post type and search by term with the Rest API?
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- Problem with multi checkboxes value in metabox?
- How to Disable option of meta field if that option is selected for any other post in custom post type?
- Query posts by multiple custom fields
- Run query on specific admin options page and send results to select field in another function
- get_previous_post_link and get_next_post_link of custom post type that share custom field value
- Automatically assign posts with custom field to taxonomy term
- Attach several custom posts to one meta field
- WordPress query in which condition uses custom field
- Show first posts with custom field not empty and order all by title
- How to add post reference field to a plugin?
- Custom post type won’t take my custom fields
- Order by custom field attribute
- Echo custom field value
- How to store datetime from custom meta box so that it can be sorted by
- Custom Post Meta on a Different Page?
- Custom Post type easy way for editors
- Adding a custom field after post title (ex.Example Title [30 Second Read])
- Creating post custom field text area
- querying to custom field over ACF REST API
- 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
- Sortable admin columns ordering from custom fields isn’t combine com search and Dropdown filter
- WordPress custom field sorting, weird behavior: the latest post is at the end
- I want to understand plugin implementation of custom posts / taxonomies / metaboxes
- How to consume external API from WordPress post editor and display the response data in the custom field?