0

(by using $query->set( 'meta_key', 'start_date' ); or $query->set( 'meta_query', $meta_query_array );) ...

how can I send a array of dates in order to wordpress understand that the post as multiple dates and so, should be displayed several times in a chronological order list ?

I try since days to understand the problem and I can't figured out.

I found a solution by separating dates in differents child posts, but as a event (post) as sometimes 20 dates, it generate 20 posts just for a date in a acf field.

Is there a clever way to do it ?

Thanks A LOT ! -Nicolas.

4
  • Can't you use BETWEEN in your meta query for this? (similar to this)
    – kero
    Nov 3, 2021 at 12:55
  • a post cannot appear multiple times in a WP_Query results, you would have to do the processing duplication and sorting in PHP
    – Tom J Nowell
    Nov 3, 2021 at 13:03
  • ;( Thank you for the information. Means I should make on my own php and mysql query ?
    – nico
    Nov 3, 2021 at 14:23
  • ... and what is the approach when they dev a calendar ? do they multiply posts ?
    – nico
    Nov 3, 2021 at 15:54

1 Answer 1

0

Probably what you wnat do is :

update_post_meta( $post_id, $meta_key, serialize($meta_value));

or to create :

add_post_meta( $post_id, $meta_key, serialize($meta_value));

or to delete :

delete_post_meta( $post_id, $meta_key);

2
  • it seems there no solution, as long as you can't display twice a post on a WP_query.
    – nico
    Nov 8, 2021 at 23:39
  • well if the taks is alter or create wp_postmeta that is the right way and 100% sure that will works
    – demopix
    Nov 10, 2021 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.