Conditional multidimensional arrays and array_map

returns with an error (array_map(): Argument #2 should be an array), as no array is present The $states[‘s_bib_source_c_bib_sources’] ?? [] is only setting $states[‘s_bib_source_c_bib_sources’] if it isn’t already set. If it’s set and it’s not an array, then array_map would throw the “should be an array” error. So you might better off use type-casting: isset( … Read more

Compare meta key to current date in pre get post

What you’re trying isn’t possible with WP_Query. The reason is that because you have only stored the duration, it’s not possible to tell whether a post has expired until you know the publication date and the duration time and add them together. That’s what this does: $expire = get_field( ‘status_time_duration’ ) + get_the_time( ‘U’ ); … Read more