wp_create_thumbnail

Definition:
function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {}

Create a thumbnail from an Image given a maximum side size.
This function can handle most image file formats which PHP supports. If PHP does not have the functionality to save in a file of the same format, the thumbnail will be created as a jpeg.

Parameters

  • mixed $file: Filename of the original image, Or attachment id.
  • int $max_side: Maximum length of a single side for the thumbnail.
  • mixed $deprecated: Never used.

Return values

returns:Thumbnail path on success, Error string on failure.

Defined filters

  • wp_create_thumbnail
    apply_filters( 'wp_create_thumbnail', $thumbpath )

Source code

function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {

	if ( !empty( $deprecated ) )

		_deprecated_argument( __FUNCTION__, '1.2' );

	$thumbpath = image_resize( $file, $max_side, $max_side );

	return apply_filters( 'wp_create_thumbnail', $thumbpath );

}

3519

wp_create_term

Definition:
function wp_create_term($tag_name, $taxonomy = 'post_tag') {}

Parameters

  • unknown_type $tag_name
  • $taxonomy

Source code

function wp_create_term($tag_name, $taxonomy = 'post_tag') {

	if ( $id = term_exists($tag_name, $taxonomy) )

		return $id;



	return wp_insert_term($tag_name, $taxonomy);

}

3517

wp_create_tag

Definition:
function wp_create_tag($tag_name) {}

Parameters

  • unknown_type $tag_name

Source code

function wp_create_tag($tag_name) {

	return wp_create_term( $tag_name, 'post_tag');

}

3515

wp_create_post_autosave

Definition:
function wp_create_post_autosave( $post_id ) {}

Creates autosave data for the specified post from $_POST data.

Parameters

  • $post_id

Source code

function wp_create_post_autosave( $post_id ) {

	$translated = _wp_translate_postdata( true );

	if ( is_wp_error( $translated ) )

		return $translated;



	// Only store one autosave.  If there is already an autosave, overwrite it.

	if ( $old_autosave = wp_get_post_autosave( $post_id ) ) {

		$new_autosave = _wp_post_revision_fields( $_POST, true );

		$new_autosave['ID'] = $old_autosave->ID;

		$new_autosave['post_author'] = get_current_user_id();

		return wp_update_post( $new_autosave );

	}



	// _wp_put_post_revision() expects unescaped.

	$_POST = stripslashes_deep($_POST);



	// Otherwise create the new autosave as a special post revision

	return _wp_put_post_revision( $_POST, true );

}

3513

wp_create_nonce

Definition:
function wp_create_nonce($action = -1) {}

Creates a random, one time use token.

Parameters

  • string|int $action: Scalar value to add context to the nonce.

Return values

returns:The one use form token

Source code

function wp_create_nonce($action = -1) {

	$user = wp_get_current_user();

	$uid = (int) $user->ID;



	$i = wp_nonce_tick();



	return substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10);

}

3511