Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’ve just come here to report the same issue. 4.6.4 breaks my advanced custom field functionality, while 4.6.3 works fine.

    Would be very interested in finding out the diffs between these versions

    Just had this myself when refactoring a plugin I’m writing.
    I moved the get_current_user_id out of a method into the constructor of my plugin object and it suddenly started to return 0.

    Looks like when the plugin is instantiated the get_current_user_id method doesn’t exist yet (i.e. not loaded by WordPress yet) so it returns 0.

    /**
     * Get the current user's ID
     *
     * @since MU
     *
     * @return int The current user's ID
     */
    function get_current_user_id() {
    	if ( ! function_exists( 'wp_get_current_user' ) )
    		return 0;
    	$user = wp_get_current_user();
    	return ( isset( $user->ID ) ? (int) $user->ID : 0 );
    }

    I’ll bet that’s what is happening here and that 4.2 has refactored when core functions are loaded.

Viewing 2 replies - 1 through 2 (of 2 total)