check_admin_referer not working in custom meta box for custom post type

Now in saving function … in which hook ? if you do this in “save_post_CPT”, it doesn’t work because this hook is called a first time a the object creation then you have to do this : add_action(“save_post_CPT”, function ($object_ID, \WP_Post $object, $update) { if (!$update) { // new object, here you can define default … Read more

Unable to save multiple images in wordpress

You are updating the same post_meta on each loop. Therefore you are probably saving the last uploaded image only. Try something like this (simplified): foreach ($_FILES[‘wp_custom_attachment’][“tmp_name”] as $key => $value) { $post_meta = get_post_meta($id, ‘wp_custom_attachment’, $upload); if( $post_meta ) { $post_meta .= ‘, ‘ . $upload; update_post_meta($id, ‘wp_custom_attachment’, $post_meta); } else { add_post_meta($id, ‘wp_custom_attachment’, $upload); … Read more

get wordpress post loop by meta box date

Have you tried passing in the $args variable to query_posts, rather than $guide? query_posts($args); Also, you should be looking to create the custom query using WP_Query class and not the query_posts. See this answer for more details (https://wordpress.stackexchange.com/a/1755) Try the below code: $args = array(‘post_type’ => ‘post’, ‘meta_key’ => ‘meta_date’, ‘meta_value_num’ => , ); $my_query … Read more

Can’t get meta values to save

Figured it out: There was a space in the field ID, and the $_POST key would collapse it. So the ID’s weren’t matching up in the foreach loop in my save function. I solved this with a sanitizing function on the IDs for my meta fields. I was further confused because my admin notices that … Read more

Metabox – Displaying the Value of a Metabox

After reviewing your code there are a couple of things you need to change depending on where the meta content is being held. Try this to get the value $desc = get_post_meta( get_the_ID(), ‘meta_desc’, TRUE ); echo $desc; That Will be give you the appropriate meta.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)