• Resolved safu9

    (@safu9)


    Hello,
    I have a problem with The Events Calendar.
    I log in WordPress with authority of author and go to the month view. When I move to prev or next month using the links under the calendar, events posted by other users don’t appear. However, when I reload the page with F5 key, they appear. I can’t guess the reason of this behavior. Please help me.

    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter safu9

    (@safu9)

    Sorry, I understand it.
    It is because I added the following code in functions.php

    function get_my_posts( $wp_query ) {
    	global $current_user;
    	if( is_admin() && !current_user_can('edit_others_posts')){
    		$wp_query->set( 'author', $current_user->ID );
    		$screen = get_current_screen();
    	}
    }
    add_action('pre_get_posts', 'get_my_posts' );

    I added “!wp_doing_ajax()” after is_admin().
    It works fine. Thank you.

Viewing 1 replies (of 1 total)
  • The topic ‘Can’t see other’s events’ is closed to new replies.