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()
- Remove Actions/Filters added via Anonymous Functions
- Check if post is being published for the first time, or is an already published post being updated
- How to influence the information displayed on widget inside wp-admin
- WordPress Theme Update Action?
- Is there a hook or function I can use to display all theme files being used on a current page?
- How to paginate the get_users function?
- Using a private method as an action callback from within a class
- Implementing DNS Prefetching with WordPress
- Help me to understand wp_header() and wp_footer() functions
- How can I add an extra WooCommerce hook
- wp_delete_user with username
- Check if has any sidebar active on current page
- Change labels on ‘Nickname’ and ‘Biographical Info’ in user-edit.php
- How to override WordPress registration and insert an auto-generated username?
- Target a certain page within wordpress backend (admin) i.e. Pages > About
- Set default options for inserting media
- Breadcrumb how i can display page title with parent > child title with permalink ? any Idea
- how to get and display logged in user’s recently read posts
- How to detect first visit of a user?
- Delete option value from array using update_option()
- Delete pages and Create default pages for all new network sites
- Make menu structure match page heirarchy on page parent change
- Gravity Forms field entries into wp_query loop [closed]
- Post thumbnail relative link and HTML modify
- Change the slug of a particular page every x hours
- How would go about if I just want a temporary function?
- Remove the deleted users avatar from list
- Get current page_id before loop, in functions.php
- Change size and crop medium_large images
- Custom HTML in specific category single page and its descendant categories
- is_account_page() change to page slug
- Inserting a functions output after the content
- Problem only while using require_once() within functions.php
- Function only on a specific page
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- Reuse variable in hook callback
- Registration Hooks don’t appear to be working
- edit_user_profile and show_user_profile are not firing inside a class
- Pass parameter to hooked function using custom page template
- Is my code correct to enqueue CSS on a specific page?
- Can’t properly set the_title add_filter to show short_URL
- (Woocommerce) Order by price when entering specific category
- Create a post builder skin in a plugin
- Auto-Tweet if Type is ‘Status’ using OAuth
- Call to undefined function is_home() or any conditional tags
- How to remove a class function from a plugin by using remove_action()?
- Rewrite to load homepage for a different url
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Suggest Users basing on User taxonomy
- Only echo Page Content (not page title & page content together)
- update_post_meta is Updating with two page id
- Problem in using Customizer
- call wp_insert_user in custom class doesnt work
- How to conditionally add a widget via a hook in functions.php
- How can I show different content for different user-levels?
- Changing the text of Upload/Insert on Posts and Pages Screen
- referencing the current user in a page i created in wordpress
- Warning at top of website & top menu gone
- Is there a way to know when a page has been updated and do some action only once?
- How do I trigger WP CLI DB export using a PHP function?
- wp_get_current_user return ID = 0 when used outside of wordpress, such as webhook / fulfillment dialogflow
- get_current_user_id() always return 0 in if else statement
- True email confirmation for registration (keeping unvalidated users from user table)
- Fatal error: Call to undefined function add_action() – an untouched problem
- Init hook for header send
- How to add a class name to the ancestor of a post?
- function to return comma separated list of meta values
- How do I add functionality to images?
- How to hook wp_mail to add a custom email as BCC for each sent email?