Assuming the function hooked to the action load_posts_by_ajax
is your load_posts_by_ajax_callback()
code (seems a reasonable assumption), the query arguments can be easily modified.
You mention “displays only 3 posts” which is what the code is designed to do. If you wish to show 10 posts, update the posts_per_page argument listed.
'posts_per_page' => '3',
The bigger portion of your question is addressed by a taxonomy query. This is how you limit your query results to a specific term (january) within a specific taxonomy (month). I am guessing on the term slug and taxonomy name in this answer, however.
Assuming there is a month
taxonomy registered for the event
post type, something like this for your query should work:
function load_posts_by_ajax_callback() {
check_ajax_referer('load_more_posts', 'security');
$paged = $_POST['page'];
$args = array(
'post_type' => 'event',
'post_status' => 'publish',
'posts_per_page' => '10', // assuming you want 10 posts returned
'tax_query' => array( // a tax query is always an array of arrays
array(
'taxonomy' => 'month', // assuming again; your taxonomy slug
'field' => 'slug',
'terms' => 'january', // you will want to assign this programmatically from the JS; not evident in the code provided
)
),
'paged' => $paged,
);
$my_posts = new WP_Query( $args );
// remainder of function code is unchanged...
Several assumptions made in this answer. If you can add the relevant code to your question I might be able to update.
EDIT: I’m not 100% confident in the paging aspect. The code you provided makes use of paging and IIRC, this should be done with the offset
argument for WP_Query. Separate question perhaps? Let’s solve the Ajax tax query first.