Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
Well in your for loop, I think you’re missing the $postcount variable… also there’s a typo at $idss[$i] …. should be $ids[i] based on what you’ve shown. for ($i = 0; $i < $postcount; $i++) { wp_update_post(array(‘ID’ => $ids[$i], ‘post_status’ => ‘draft’)); } That being said I’d just go with a foreach loop. The mistake … Read more
Unfortunately, WordPress doesn’t have a built-in way to sort by taxonomy term. You do, though, have a couple of options. You can iterate through your taxonomy terms and run a separate wp_query for each as this post shows. You can directly manipulate the SQL query to achieve what you want. This article shows how. Look … Read more
Strange Behavior with update_option
Featured image on archive page based on post type
If you look at the source of the Ajax Load More plugin, you can see a number of filters you can use to modify the query. You’ll likely want to use the alm_modify_query_args filter like so: $in_array = [ 115, 123, 66, 64 ]; add_filter( ‘alm_modify_query_args’, function( $args ) use ( $in_array ) { $args[ … Read more
From the php manual the array_key_exists() function takes as first argument “any value possible for an array index.”, again looking up for arrays in the docs we can get that “The key can either be an integer or a string. The value can be of any type.”, which also corresponds to the error you see … Read more
You don’t have any conditions for “any” as a given value in your code, so it won’t be treated as any, but as “any”. But your code checks if given value is not empty, so passing it like so should work: api.php?key=fruit,drink&value=,whiskey PS. I’m not sure if that’s the best way of passing arguments to … Read more
This is your problem: $follow_ids = $wpdb->get_results( “SELECT meta_value FROM brilli_usermeta WHERE user_id = “.$user_id ); No meta key is specified, and it’s a raw SQL query, which means all user meta values are returned, even those that aren’t relevant. You need to specify a key But why bother with a direct query, when a … Read more
Ok, I figured it out myself. So maybe I can help someone out with the same question. I made a custom field TRUE / FALSE called “featured”. In facet WP I created this query: <?php return array( ‘post_type’ => ‘custom_post_type’, ‘post_status’ => ‘publish’, ‘meta_query’ => array( ‘is_featured’ => array( ‘key’ => ‘featured’, ‘compare’ => ‘EXISTS’ … Read more