ajax load more button not working properly when ‘author’ field is added
-
Hi,
I have been using the plugin for a while. I have a custom loop where it needs to grab custom post from the logged in user. I have below code:
$project_args = array( 'id' => 'user-posts-list', 'post_type' => 'custom_post_type', 'post_status' => 'publish', 'posts_per_page' => 1, 'author' => get_current_user_id(), 'init_load' => 10, 'template' => 'mycustom-template-list' ); echo cpt_alm_render($project_args);
and below code in my functions.php
add_filter('cpt_alm_query_args','cpt_export_custom_loop',10,2); function cpt_export_custom_loop($args, $id){ if($id == 'user-posts-list'){ $args['author'] = get_current_user_id(); } return $args; }
the loop is working fine when the page is loaded but when ‘load more’ button is clicked, other author’s posts are loaded.
please help me fix this.
Regards,
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘ajax load more button not working properly when ‘author’ field is added’ is closed to new replies.