Pagination and Related Posts

Yes, it is possible but might be a little complicated to apply the ‘paged’ variable to the arguments. You’ll need pagination functions which do the ajax calls to receive and apply the ‘paged’ var.

Display all post types together

For the first part of your question, a pre_get_posts hook is all you would need. This code should work, providing you are using the default “Latest Posts” setting as your front page (Settings > Reading). add_action( ‘pre_get_posts’, ‘se132019_home_page_all_post_types’ ); function se132019_home_page_all_post_types( $query ) { if ( ! is_admin() $query->is_main_query() && $query->is_posts_page() ) { $query->set( ‘post_type’, … Read more

Trash a post, send associated comments into the trash bin (change status)

There’s an action called trashed_post_comments that runs right after the comments are set to post-trashed status. You could hook into that: add_action( ‘trashed_post_comments’, ‘wpse134528_really_trash_comments’ ); function wpse134528_really_trash_comments( $post_id ) { $args = array( ‘post_id’ => $post_id, ‘status’ => ‘post-trashed’, ); $comments = get_comments( $args ); foreach( $comments as $comment ) { wp_trash_comment( $comment->comment_id ); } … Read more

Add tags to post before it’s created

I tried to use the filter wp_get_object_terms like this: function add_object_terms($terms, $object_ids, $taxonomies, $args){ if (isset( $_GET[ ‘tags’ ]) && str_replace(“‘”,””,$taxonomies) == “post_tag”) { $newterms = explode(“,”,$_GET[‘tags’]); return array_merge($terms, $newterms); } else { return $terms; } } add_filter(‘wp_get_object_terms’, ‘add_object_terms’,1,4); That doesn’t work though, maybe the return value has the wrong format, I didn’t look it … Read more