Maybe because $user_levels is an array?
Try something like:
// Compare user_levels with post_level
$result="";
foreach($user_levels as $user_level) {
$result .= array_search($user_level, $post_levels);
}
if ($result) {
return true;
}
Related Posts:
- How to get membership level for specific user email
- Solution to render Shortcodes in Admin Editor
- How to run a function every 5 minutes?
- Upload Multiple Files With media_handle_upload
- Define page template in wp_insert_post
- Add custom template page programmatically
- Child theme functions.php do I use php open and close tags?
- Modify Admin Bar Link
- How to override admin-bar style
- Woocommerce add to simple product attribute programmatically [closed]
- WP 4.4. responsive loads normal image after loading the responsive image
- How can I tell if I’m on a login page? [duplicate]
- Get Category and Excerpt From wp_get_recent_posts
- When is wp_trim_excerpt() called?
- What is wrong with this Shortcode? I get it in a wrong place inside the content
- How do you completely remove the default header and footer using functions.php?
- Unregister Nav Menu with fallback?
- Enqueuing Script in functions.php vs on the page
- Allowing SVG uploads in media uploader without plug-in
- What does the author_nicename parameter do in get_author_posts_url()?
- Members only site – still need the lost password page accessible
- Load JS Script only for custom post types
- Hook specific functions if on a specific admin page
- How to overwrite / extent wordpress function is_email
- WordPress upload_mimes not working for front-end uploads of 3D files
- How do I customize my wordpress Admin Area?
- Add caption functionality to custom WordPress theme
- User meta and author meta
- List all-childpages on parent-page AND list child-pages on childpage itself but not the current one?
- Removing permalink from post thumb in twentyeleven
- Product object returns no sale price
- Default Custom Field Value Automatically Update
- meta tags doesnt fetch data from permalinks
- Add button to kitchen sink toggle
- Get User Login Data (date, time… )
- How to know if user logged in
- Option Tree integration of Custom CSS
- Modify post filter to set custom number of posts per page and exclude child posts
- Remove “Published On” inside wp-admin
- Can’t call Javascript function – scope?
- Deprecated function get_user_by_email($email)
- header_image() with CSS
- Shortcode parse error – wrong syntax
- Load custom css in functions.php causing library issue
- Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?
- Getting commenter meta
- In jquery use php variable to execute an enqueued jquery file
- Run a jquery script on on a certain template page
- How can i unload effect.min.js file?
- Native gallery custom html output
- Can’t add_action to ‘save_post’ and get it to fire
- Auto scroll to id on page load on all pages except home page. Only do this on mobile
- why is this function firing on all child menu items as well?
- Custom styles in Tiny MCE with an external CSS file
- I changed Functions.php and now I get “cannot decode raw data NSURLErrorDomain:-1015” (not blank)
- How to load jQuery in TOP of wp_footer?
- How to fetch custom post type by variable date?
- Use add_action within template
- two search forms on the same page
- Getting out side of wp root folder from function.php using absolute path
- How do I register a new settings page? [closed]
- contact form in template with jquery,validate and ajax
- Changing the header image using WPML
- current_page_item is missing inside wp_nav_menu
- Change default upload images size for contributors
- Strange error from functions.php files (wp_register_script)
- file.php not loaded?
- How to setup a popup registeration page in wordpress with function.php
- Display ACF category image on archive and single template files
- How to add if statement on WordPress shortcode output
- Auto delete content in specific folder inside media library
- Using get_terms for custom taxonomy in functions.php
- Why does modifying the “read more” link remove the link class?
- How to update an image attachment’s alt text from a custom field when saving a post?
- How Do I Unhook This Parent Theme Function?
- Woocommerce product price change
- Allow user only create specific tags
- How to create an array if ’empty’?
- How to display different blocks for mobile and desktops
- i can’t use wordpress functions in ajax loaded php file
- Woocommerce – Switching Price for Category
- Help wiht adding fullcalendar.io to a WordPress page
- WP Enqueue Script Error
- Enqueue JS + CSS via a child theme functions.php file?
- How to create a WordPress Customizer Button to Clear a Cache?
- Move product attributes after summary on single product page
- Javascript and Stylesheet in child page
- How to add number to wordpress count function?
- How do I integrate my Child Theme into a Custom Template?
- Why are some custom javascript files working but some are not
- Custom Nested WordPress Comments with avatar
- Archive.php, and post_is_in_descendant_category
- Having problems loading Jquery in functions.php
- Functions file mods and CPU
- How can I append and prepend something to all post hyperlinks without using ::before or ::after? PHP hook solution?
- How to overwrite ‘read more” text for artmag theme
- How to display milliseconds instead of seconds using timer_stop function? [closed]
- Retrieving next_post_link() and previous_post_link() in functions.php
- Setcookie not setting cookies anywhere except admin
- WooCommerce, change “Add to Cart” to “Link to Product”, only for specific categories