It gives an array with objects. So in_array()
won’t find anything, you have to convert it before. After you get the results from wbdb:
$employees_array = array();
foreach($employees as $employee) {
$employees_array[] = $employee->meta_value;
}
if(in_array($company, $employees_array)) {
...
}
Related Posts:
- Extract image from content and set it as the featured image
- Add action hook conditionally – only when home.php in use
- How can I tell if I’m on a login page? [duplicate]
- Remove Page Title from Static Frontpage
- How to hook into the quick edit action?
- WooCommerce add_action hook results in 500 error
- how to change link of some wordpress pages
- Accepted arguments value in hook functions
- Which action hook to use for function?
- Modify a function without editing template
- Which action does wp_update_user triggers?
- How can I get my Script to work on the Login page?
- Trigger a custom function when option are saved in admin area
- Execute a ultimate member action when user role is updated
- jQuery does not work
- Override the WordPress core function wp_referer_field
- What is the text that appears beside the page titles in the list of pages in the WP admin?
- Is there a way to prevent a function/method from being called outside a specific hook?
- Adding code before post title with the_title produces weird results
- Add back in child theme what the parent theme removed with remove_action
- Changing where my author box is printed
- Insert Content Before div#main from the functions.php File
- Replace admin header logo with an image
- Does hook have an effect on increasing the page load?
- Save_post – Warning: Cannot modify header information
- What is the earliest Hook a Script can use?
- How Do I Unhook This Parent Theme Function?
- WordPress hooks to call a function inside a construct
- delete_term is not working properly with add_action()
- Function attached to cron job not running but will run if called manually
- Function added using `add_action()` not being called
- edit_user_profile and show_user_profile are not firing inside a class
- Difference b/w Simple function call & do_action call
- Why does re-using this function not work? [closed]
- Pass parameter to hooked function using custom page template
- How to return hook data when multiple parameters are present?
- Hook into a function without a hook?
- Set Taxonomy based on post status
- Two functions with different arguments and add_actions, but identical code
- How to edit the Tags within the image file URLs?
- Condition OR for current user ID
- Is my code correct to enqueue CSS on a specific page?
- Can’t properly set the_title add_filter to show short_URL
- Control the srcset much more (not all sizes in it each time)
- add_action template_redirect not working for home page
- I can’t seem to install Font Awesome locally [closed]
- How to add_filter html template to middle of content
- Filter yoast canonical add_action priority [closed]
- AMP – Change rel=”canonical” from functions.php [closed]
- (Woocommerce) Order by price when entering specific category
- How do I hook into the container of wp_nav_menu?
- Scripts not loading when using the wp_enqueue_scripts action
- Remove links from the_content when using filters wp_trim_excerpt
- Create a post builder skin in a plugin
- Plugin Development – Functions or Hooks?
- Auto log in hook is requiring a page refresh
- Auto-Tweet if Type is ‘Status’ using OAuth
- Missing argument for the function
- Enqueue script on every page except one
- problem loading stylesheets to wp_head dynamically
- Are there action hooks for comments?
- WordPress redirect redirecting too many times or not at all
- current_user_can comma list vs OR (||) list
- Call to undefined function is_home() or any conditional tags
- Possible to hook into Media Library preview File column and use a custom image?
- Function not working inside of a function in functions.php
- How to Use Global Variables Inside Header and Footer
- Secondary Menu and Logged In Users
- Why get_user_by() doesn’t work in my code?
- login_headertitle is deprecated since version 5.2.0
- Writing a function to detect an event
- Filter to wp_list_authors
- How to properly refresh page after form action?
- Init action and refresh page after form action
- 400 Bad Request – JavaScript App calling Custom wp-json endpoint
- How to remove a class function from a plugin by using remove_action()?
- Rewrite to load homepage for a different url
- This code works, but the way I integrated it is breaking the media uploader. How can I integrate it properly?
- How to add array [closed]
- WordPress wraps span tags into p tags
- Add Link to Users List (Backend) to open each users front-end profile
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Add Adsense code between job listings – wp job manager plugin
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Suggest Users basing on User taxonomy
- Add action to custom Function
- Use add_action within template
- How do I register a new settings page? [closed]
- Showing user profile data on front-end
- Only echo Page Content (not page title & page content together)
- update_post_meta is Updating with two page id
- Problem in using Customizer
- Problem with custom function when I go back with the browser
- Modify function to only return values for the user that’s logged in
- New checkbox in custom widget isn’t saving data
- loginout function customization
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- User meta and public function security
- call wp_insert_user in custom class doesnt work
- get content from page through AJAX