$args = array( 'post_status' => 'published', 'posts_per_page' => 77, 'post_type' => 'post', ); $query = new WP_Query($args); while ($query->have_posts()) : $query->the_post(); $literature = get_post_meta(get_the_ID(), 'popis_literature'); var_dump($literature); endwhile; for some posts var_dump gives an array of data like this … [Read more...] about How to set meta_query if get_post_meta returns nested array for that key?
Get_post_meta returns empty
get_post_meta returning no value in custom post type alert email
add_action( 'transition_post_status', 'pending_post_status', 10, 3 ); function pending_post_status( $new_status, $old_status, $post ) { $author_id=$post->post_author; $address = get_the_author_meta('user_login', $author_id); $user_id = get_current_user_id(); $user_info = get_userdata($user_id); $edit_author = $user_info->user_login; $post_id = $post->ID; $post_cat = get_post_meta( $post_id, 'glossary_tag', true); if ( ( $new_status === "pending" ) && ( $post->post_type == 'glossary_post' ) ){ $post_title = $post->post_title; $to = 'XXXXXX.com'; $subject = 'A Glossary term has been created'; $message = 'A new Glossary term named "' . $post_title . '" has been created in the category "' . $post_cat . '" by ' . $address . '. Please login at XXXXX to review and then publish if acceptable.'; wp_mail( $to, $subject, $message ); } } I have tried changing $post_cat = get_post_meta( $post_id, 'glossary_tag', true); to false at the end and that returns "Array". Each post … [Read more...] about get_post_meta returning no value in custom post type alert email
get_post_meta returns Array instead of image url
<?php $args = array( 'posts_per_page' => 2,'offset'=> 0,'category_name' => 'slider','post_type' => 'post','post_status' => 'publish' ); $myposts = get_posts( $args ); foreach ( $myposts as $post ) : setup_postdata( $post ); $background_sl = get_post_custom_values($key = 'rd_background','url'); ?><li><img src="<?php echo esc_url($background_sl); ?>"></li> <?php endforeach; wp_reset_postdata();?> … [Read more...] about get_post_meta returns Array instead of image url
meta_post_meta return value 1
I want to return some post meta , but when i use the functions get_post_meta or get_post_custom the functions returns allways the values 1 for all the meta data, i tried several thinks but they returns the same value , i suspect that they returns boolean value. In the wp_postmeta table the meta_value is equal to 30. … [Read more...] about meta_post_meta return value 1
get_post_meta and add_post_meta not working
$ggowlccpy_transaction_details_capture = array( 'merchant_ref' => $ggowlccpy_order_id, 'transaction_id' => $ggowlccpy_response['transaction_id'], 'transaction_tag' => $ggowlccpy_response['transaction_tag'], 'method' => $ggowlccpy_response['method'], 'amount' => $ggowlccpy_response['amount'], 'currency_code' => $ggowlccpy_response['currency'], 'positionofsave' => 'captured', ); update_post_meta($post->ID, '_ggowlccpy_trasaction_capture', $ggowlccpy_transaction_details_capture); add_post_meta( $post->ID, '_ggowlccpy_refund_details_get', base64_encode(serialize($ggowlccpy_transaction_details_capture)) ); $data = get_post_meta( $ggowlccpy_order_id, $key = '_ggowlccpy_refund_details_get', $single = false ); $tb_meta_unserialized = unserialize(base64_decode($data)); error_log(var_export($tb_meta_unserialized, 1)); echo $tb_meta_unserialized; … [Read more...] about get_post_meta and add_post_meta not working