$value['postal_codes']
is not an array
it is a string
, you either need to explode it like:
foreach ( $myoptions as $key => $value ) {
if (in_array($p,explode(","$value['postal_codes']){
// need to know $key of which array the $p was found, in this case I would like to find [0]
}
}
Or search on the string
foreach ( $myoptions as $key => $value ) {
if (strstr($value['postal_codes'],$p){
}
}
Or the most efficient way would be use array_search on the exploded like so:
foreach($myoptions as $key => $options) {
$keys_containing_p[$key] = array_search($p,explode(",",$options['postal_codes']));
}
Related Posts:
- Save and retrieve custom plugin options value
- Is it ok to call get_option without hooks?
- Settings API – input always updates over validation
- Serialize data for wp options
- Add Plugin options as subpage to Theme options page
- Create tabs in admin options page from custom post type loop
- Plugin Options not being output
- Gathering and logging data from a plugin: how to do it without race conditions?
- How to automatically redirect to custom admin menu after plugin activation?
- wp_options not returning value for logged out users?
- how to show new field if option selected?
- How to store multiple instances of the plugin’s options for various shortcodes
- Plugin options not appearing on options page using tabbed navigation
- Include paths and functions for external scripts
- How to Add WYSIWYG Editor (tinyMCE) to plugin options page compatible with WordPress 3.0 and up?
- What is a Network Activated Plugin Exactly?
- Install an external plugin within the current plugin
- WooCommerce – Call to undefined function is_woocommerce()
- How to distinquish wordpress served links from non-wordpress served links
- Upgrading WordPress 4.0 asks for FTP password
- do_shortcode() doesn’t work if shortcode contained in variable, works if shortcode passed as string
- Is there a way to lock certain pages from being edited by anyone other then the admin?
- WordPress ajax call for not logged in users, doesn’t work
- Issue with post request to admin-post.php
- Add multiple attributes to product from php
- Built in audio player?
- How to show my sidebar in specific page only?
- like to keep reading plugin
- Check if email address exists front end with AJAX in a plugin
- Add category to body class
- Plugin Development sqlite or WordPress’ database
- How to review WordPress website php version compatibility?
- WordPress plugin for activating other plugins
- Translate database content using __($message) function
- Add Extra codes by plugin
- Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)
- Admin Theme customization
- Keep a post copy when this one is updated – issue
- WordPress web pages keep getting deleted (moved into the trash) by themselves
- wordpress json api not working
- Post custom Data value in The Events Calendar plugin [closed]
- WordPress plugin creation how to execute .sql in order to insert multiple rows at activation of plugin
- Problem with PHP wordpress, Undefined index: in C:\xampp\htdocs\wordpress\wp-content\plugins\epoch\classes\core.php on line 190 [closed]
- How to create a custom shortcode based on the layout?
- Installing plugins and using complex folder structure with child theme in WordPress
- Implementing an image hosting website using WordPress? [closed]
- Plugins ignored a line breaks or tag in the WordPress comment functions
- How to get path or root of plugin folder, not file or dir?
- Displayed content disappears when adding attributes to shortcode
- What is the easiest way to rename a plugin (and also avoid plugin updates)
- Display linked articles at the bottom of post (like related posts)
- register_activation_hook() not working as expected
- Plugin not working & permalink erorr after upgrade to php 7x on Nginx
- Is there a way to remove a tooltip of a plugin via custom CSS? [closed]
- How to add update function to plugin without adding it to https://wordpress.org/plugins/ [closed]
- 500 error when updating plugin option
- How to edit link for comment count
- Personalized Author Area
- New Variable Woocommerce product not showing variations, price, or add to cart on front end [closed]
- WP-ecommerce : Change the price before inserting it into the cart
- Integrating Custom Database with WordPress
- How do I duplicate a single wpmu site?
- Dynamic landing page – am I doing this right?
- How to add height and width to images on a page(using WP Bakery) to improve Google’s CLS score?
- how to display a template.php in a shortcode
- Woocommerce add products to cart
- I need to register and resize images, safe to delete plugin afterwards?
- Using mu-plugins on the Genesis Framework
- Is it possible to custom set query for a WordPress REST API response?
- wpdb update method is updating but not refreshing the current page data
- How to send custom mail when a user complete a specific form
- How to echo meta_key in easy digital downloads receipt (Purchase Confirmation page)
- Generating shortcode and HTML on button click
- Plugin error “array_key_exists(): The first argument should be either a string or an integer” [closed]
- Show content from plugin on index
- Sub Categories in drop down menu
- “Listen” button on my main post page
- CMB2 Post Search Field displays/repeats initial post if left empty
- User content database [closed]
- Add HTML between feed items
- Private “Parents” content for school site
- Form submit from wordpress plugin
- Can a developer adopt a plugin marked as “not updated in over 2 years”?
- disable lightbox in a plugin [closed]
- How to include css for plugin setting page? [duplicate]
- Encode URL picked up by Digg Digg
- Allow a role to edit one specific plugin
- Post curl function save twice using plugin hook function wordpress
- Frontpage Admin Bar Disappeared
- WP Customer Reviews call short code on another page [closed]
- Need help saving input fields for Security Deposit plugin in WC Vendors page
- Getting warning of Missing argument 2 for wpdb::prepare()
- wordpress plugin noob situation
- turn off WooCommerce for a site in a multi site environment
- Count div with class (.length) only shows 0 [closed]
- Suitable hook when creating, updating and deleting posts programmatically
- how to make yoast seo read text from custom fields in custom post type
- How can I gather forums posted by visitors from different sites in one place? [duplicate]
- Does anyone recognize these table names?
- On WordPress.org Plugin repository, Last Updated Date doesn’t match with Plugin Version Update Date