Compare meta_query with a Regular Expression and do a less-than operation on it
Compare meta_query with a Regular Expression and do a less-than operation on it
Compare meta_query with a Regular Expression and do a less-than operation on it
I have managed to find the reason behind this and create a solution suitable for my needs. Under screen options on the post edit page is an option called “Custom Fields”. This lists all of the custom meta values that have been saved against the post and allows you to create new ones and edit … Read more
I solved this problem with 3 lines of code after calling get_post_meta(): if (!is_array($post_meta)) { $post_meta = array(); }
hide posts with specific meta data from admin page
Just save the array to post meta as you save string- $data = array(“200”, “201”, “202”); //Update inserts a new entry if it doesn’t exist, updates otherwise update_post_meta($post_ID, ‘_parent_id’, $data); The for getting the post call get_post_meta like below- get_post_meta($post_ID, ‘_parent_id’, true); You’ll get the array. Then run for or foreach loop to show the … Read more
Compare old meta with new post meta
If you want to target meta key vendor and meta value farsi, you need to pass the following meta_query arguments: $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘product’, ‘meta_query’ => array( array( ‘key’ => ‘vendor’, ‘value’ => ‘farsi’, ) ) ); Also to note, as Jiten highlighted, your meta key may be wpcf-vendor.
The answer was that I was not referencing the 0 index of the json post-meta-fields array. It was trying to return an array instead of just the string. Instead of ‘color’ => $article_array[‘post-meta-fields’][‘color’] I needed ‘color’ => $article_array[‘post-meta-fields’][‘color’][0]
The proper way would be to check if you are on a single page, and if so, then check if your post has the oznamy set as one of its categories. Let’s rewrite your code the following way: if ( is_single() && in_category( ‘oznamy’ , get_the_ID() ) ) { // Get the current user $current_user … Read more
From your code, this is the part where you can get the mark, modified to get only one: $member_id = get_current_user_id(); $course_id = 1; //i am assuming the ID of the course $status = get_user_course_status($member_id,$course_id); if($status > 3){ $mark = get_post_meta($course_id,$member_id, true); echo $mark; }