• Jack

    (@jack1132132)


    Hello,

    I’ve noticed on the file plf-filter.php there this block of code:

    if ( !function_exists('is_user_logged_in') ) :
    function is_user_logged_in() {
    	if ( ! function_exists( 'wp_set_current_user' ) )
    		return false;
            
    	$user = wp_get_current_user();
    
    	if ( ! $user->exists() )
    		return false;
    
    	return true;
    }
    endif;

    Shouldn’t if ( ! function_exists( 'wp_set_current_user' ) ) really be if ( ! function_exists( 'wp_get_current_user' ) ) ?

    Thank you.

Viewing 1 replies (of 1 total)
  • Plugin Author enomoto celtislab

    (@enomoto-celtislab)

    Plugin load filter utilizes the WP core processing as much as possible to determine various conditions such as page type, post ID, wp-admin admin page, etc. that cannot yet be determined by normal plugin loading timing.

    In order to make these judgments, we define functions in advance that perform the minimum necessary equivalent processing from wp-includes/pluggable.php, which is normally loaded after the plugin is loaded. This is necessary to make various conditional decisions before the plugin is loaded

    wp_set_current_user and wp_get_current_user functions are defined in pluggable.php, and the equivalent functions are predefined in plf-filter.php at the same time, so this description will not cause problems.

Viewing 1 replies (of 1 total)
  • The topic ‘wp_set_current_user instead of wp_get_current_user?’ is closed to new replies.