Compare old meta with new post meta
Compare old meta with new post meta
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; }
Yes, it is. Add this code to your theme’s functions.php: function my_wp_head_action() { // must be a single post/page if( is_page() || is_single() ) { $post = get_post(); $author = get_user_option( ‘display_name’, $post->post_author ); echo ‘<meta name=”author” content=”‘. esc_attr( $author ) .'” />’; } } add_action( ‘wp_head’, ‘my_wp_head_action’ ); Or, if you really want to … Read more
I found out that actually, in a new Post creation, the Post Meta is not actually available yet! I was trying to get something that wasn’t available! Check – How to access the post meta of a post that has just been published? …. which says … “when you publish the post and ‘publish_post’ is … Read more
update_post_meta saves nothing in database when run in publish_post
I’m not sure that this is what you wanted, but let me try… <?php $titles = get_post_meta( $post->ID, ‘title’ ); $urls = get_post_meta( $post->ID, ‘title’ ); ?> <table> <thead> <tr> <th>Title</th> <th>Download URL</th> </tr> </thead> <tbody> <?php foreach ( $titles as $k => $title ) : ?> <tr> <td><?php echo esc_html($title); ?></td> <td><?php echo esc_html( … Read more
Get User Post if Private