I want to append some posts to the wp_get_recent_posts function, so they are always retrieved with the normal results, the problem is that I dont get the posts I want to append in the results, am I doing something wrong?
$include = array(1, 2);
$args = array(
'showposts' => 10,
'tag_id' => '123',
'post_status' => 'publish',
'exclude' => $current_id,
'orderby' => 'post_date',
'append' => $include,
);
$entries = wp_get_recent_posts($args, 'ARRAY_A');
If I remove the tag_id argument then the posts I want to append are included in the results but I need to filter the normal results by tag ID, seems that WP also filters the appended posts with the other arguments, is there any workaround?
According to https://codex.wordpress.org/Function_Reference/wp_get_recent_posts there is no ‘append’ parameter, but there is an ‘include’ parameter that does what you want.
Try this: