Tag Info

Hot answers tagged

1

Reordering the way you want is really pretty trivial. Proof of concept: $p = array(1,2,3); var_dump($p); array_push($p,array_shift($p)); var_dump($p); With the WordPress code: $p = get_posts('posts_per_page=3'); array_push($p,array_shift($p)); var_dump($p); To make it more interesting, you can do the same with a filter. Since get_posts() uses ...


1

I don't believe you can accurately compare values for a Serialized Array, which happens whenever you pass an array to update_post_meta, you need to get the entire value during your loop using get_post_meta( $post->ID, 'enterprise_on_page', 1 ) If you need to specify queries based on these values it's best to save them out separately. View this ...


1

As your data is currently structured, you can't use SQL to do that (well, not in a performant way, at least). You have two options: Fetch ALL posts and loop through them in memory looking for the correct post meta, or Store the meta values separately. Between the two, I advise the latter. WordPress permits you to store multiple rows of the same post meta ...



Only top voted, non community-wiki answers of a minimum length are eligible