How do I reorder (pop and push) items from WP_Query?
You could use the Metadata API to retrieve the rw_advertising_position metadata for each post, seperate the ads from the content, and then re-insert the ads at the proper locations: /** * Extracts from an array posts with positional metadata and re-inserts them at the proper * indices. See https://wordpress.stackexchange.com/questions/210493 **/ function wpse_210493_apply_advertising_position( &$posts, $return = … Read more