wp_clone

Definition:
function wp_clone( $object ) {}

Copy an object.

Parameters

  • object $object: The object to clone

Return values

returns:cloned object

Source code

function wp_clone( $object ) {

	// Use parens for clone to accommodate PHP 4.  See #17880

	return clone( $object );

}

3479

wp_clear_scheduled_hook

Definition:
function wp_clear_scheduled_hook( $hook, $args = array() {}

Unschedule all cron jobs attached to a specific hook.

Parameters

  • string $hook: Action hook, the execution of which will be unscheduled.
  • array $args: Optional. Arguments that were to be pass to the hook’s callback function.

Source code

function wp_clear_scheduled_hook( $hook, $args = array() ) {

	// Backward compatibility

	// Previously this function took the arguments as discrete vars rather than an array like the rest of the API

	if ( !is_array($args) ) {

		_deprecated_argument( __FUNCTION__, '3.0', __('This argument has changed to an array to match the behavior of the other cron functions.') );

		$args = array_slice( func_get_args(), 1 );

	}



	while ( $timestamp = wp_next_scheduled( $hook, $args ) )

		wp_unschedule_event( $timestamp, $hook, $args );

}

3477

wp_clear_auth_cookie

Definition:
function wp_clear_auth_cookie() {}

Removes all of the cookies associated with authentication.

Defined actions

  • clear_auth_cookie
    do_action('clear_auth_cookie');

Source code

function wp_clear_auth_cookie() {

	do_action('clear_auth_cookie');



	setcookie(AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);

	setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);

	setcookie(AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);

	setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);

	setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);

	setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);



	// Old cookies

	setcookie(AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);

	setcookie(AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);

	setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);

	setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);



	// Even older cookies

	setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);

	setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);

	setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);

	setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);

}

3475

wp_clearcookie

Clears the authentication cookie, logging the user out. This function is deprecated.

Source code

function wp_clearcookie() {

	_deprecated_function( __FUNCTION__, '2.5', 'wp_clear_auth_cookie()' );

	wp_clear_auth_cookie();

}

3473

wp_check_post_lock

Definition:
function wp_check_post_lock( $post_id ) {}

Check to see if the post is currently being edited by another user.

Parameters

  • int $post_id: ID of the post to check for editing

Return values

returns:False: not locked or locked by current user. Int: user ID of user with lock.

Defined filters

  • wp_check_post_lock_window
    apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 )

Source code

function wp_check_post_lock( $post_id ) {

	if ( !$post = get_post( $post_id ) )

		return false;



	if ( !$lock = get_post_meta( $post->ID, '_edit_lock', true ) )

		return false;



	$lock = explode( ':', $lock );

	$time = $lock[0];

	$user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true );



	$time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 );



	if ( $time && $time > time() - $time_window && $user != get_current_user_id() )

		return $user;

	return false;

}

3471