0

I have a custom post type with a date query and these posts only shows on the post archive list when I create a normal non custom post and save this normal post then both the custom post and normal post show up. From what I understand (little) I think the issue is related to the post meta data right? And the post meta data not being saved. How do I make the post meta data save when custom post type is saved? And also why does the custom post show up after I save a normal post? Please answer that too so I understand the logic.

I tried adding this code and this code only seems to work if there are currently other posts with the same date, (year and month). If it is a new date that has no other posts then the archive does not show the post yet.

function save_my_metadata($ID = false, $post = false){
 global $ah,$eros;
 if($post->post_type != $eros)
  return;
 update_post_meta($ID,'my_metadata',$_POST['my_metadata']);
}
add_action('save_post','save_my_metadata');
add_action('post_updated','save_my_metadata');

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.