wp_embed_register_handler

Definition:
function wp_embed_register_handler( $id, $regex, $callback, $priority = 10 ) {}

Register an embed handler. This function should probably only be used for sites that do not support oEmbed.

Parameters

  • $id
  • $regex
  • $callback
  • $priority

Source code

function wp_embed_register_handler( $id, $regex, $callback, $priority = 10 ) {

	global $wp_embed;

	$wp_embed->register_handler( $id, $regex, $callback, $priority );

}

3629

wp_embed_handler_googlevideo

Definition:
function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) {}

The Google Video embed handler callback. Google Video does not support oEmbed.

Parameters

  • array $matches: The regex matches from the provided regex when calling wp_embed_register_handler().
  • array $attr: Embed attributes.
  • string $url: The original URL that was matched by the regex.
  • array $rawattr: The original unmodified attributes.

Return values

returns:The embed HTML.

Defined filters

  • embed_googlevideo
    apply_filters( 'embed_googlevideo', '<embed type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docid=' . esc_attr($matches[2])

Source code

function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) {

	// If the user supplied a fixed width AND height, use it

	if ( !empty($rawattr['width']) && !empty($rawattr['height']) ) {

		$width  = (int) $rawattr['width'];

		$height = (int) $rawattr['height'];

	} else {

		list( $width, $height ) = wp_expand_dimensions( 425, 344, $attr['width'], $attr['height'] );

	}



	return apply_filters( 'embed_googlevideo', '<embed type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docid=' . esc_attr($matches[2]) . '&amp;hl=en&amp;fs=true" style="width:' . esc_attr($width) . 'px;height:' . esc_attr($height) . 'px" allowFullScreen="true" allowScriptAccess="always" />', $matches, $attr, $url, $rawattr );

}

3627

wp_embed_defaults

Definition:
function wp_embed_defaults() {}

Create default array of embed parameters.

Return values

returns:Default embed parameters.

Defined filters

  • embed_defaults
    apply_filters( 'embed_defaults', array(

    'width' => $width,

    'height' => $height,

    )

Source code

function wp_embed_defaults() {

	if ( !empty($GLOBALS['content_width']) )

		$theme_width = (int) $GLOBALS['content_width'];



	$width = get_option('embed_size_w');



	if ( empty($width) && !empty($theme_width) )

		$width = $theme_width;



	if ( empty($width) )

		$width = 500;



	$height = get_option('embed_size_h');



	if ( empty($height) )

		$height = 700;



	return apply_filters( 'embed_defaults', array(

		'width'  => $width,

		'height' => $height,

	) );

}

3625

wp_edit_posts_query

Definition:
function wp_edit_posts_query( $q = false ) {}

Run the wp query to fetch the posts for listing on the edit posts page

Parameters

  • array|bool $q: Array of query variables to use to build the query or false to use $_GET superglobal.

Defined filters

  • $per_page
    apply_filters( $per_page, $posts_per_page )
  • edit_posts_per_page
    apply_filters( 'edit_posts_per_page', $posts_per_page, $post_type )

Source code

function wp_edit_posts_query( $q = false ) {

	if ( false === $q )

		$q = $_GET;

	$q['m'] = isset($q['m']) ? (int) $q['m'] : 0;

	$q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;

	$post_stati  = get_post_stati();



	if ( isset($q['post_type']) && in_array( $q['post_type'], get_post_types() ) )

		$post_type = $q['post_type'];

	else

		$post_type = 'post';



	$avail_post_stati = get_available_post_statuses($post_type);



	if ( isset($q['post_status']) && in_array( $q['post_status'], $post_stati ) ) {

		$post_status = $q['post_status'];

		$perm = 'readable';

	}



	if ( isset($q['orderby']) )

		$orderby = $q['orderby'];

	elseif ( isset($q['post_status']) && in_array($q['post_status'], array('pending', 'draft')) )

		$orderby = 'modified';



	if ( isset($q['order']) )

		$order = $q['order'];

	elseif ( isset($q['post_status']) && 'pending' == $q['post_status'] )

		$order = 'ASC';



	$per_page = 'edit_' . $post_type . '_per_page';

	$posts_per_page = (int) get_user_option( $per_page );

	if ( empty( $posts_per_page ) || $posts_per_page < 1 )

		$posts_per_page = 20;



	$posts_per_page = apply_filters( $per_page, $posts_per_page );

	$posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page, $post_type );



	$query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page');



	// Hierarchical types require special args.

	if ( is_post_type_hierarchical( $post_type ) && !isset($orderby) ) {

		$query['orderby'] = 'menu_order title';

		$query['order'] = 'asc';

		$query['posts_per_page'] = -1;

		$query['posts_per_archive_page'] = -1;

	}



	if ( ! empty( $q['show_sticky'] ) )

		$query['post__in'] = (array) get_option( 'sticky_posts' );



	wp( $query );



	return $avail_post_stati;

}

3623

wp_edit_attachments_query

Definition:
function wp_edit_attachments_query( $q = false ) {}

Parameters

  • unknown_type $q

Defined filters

  • upload_per_page
    apply_filters( 'upload_per_page', $media_per_page )

Source code

function wp_edit_attachments_query( $q = false ) {

	if ( false === $q )

		$q = $_GET;



	$q['m']   = isset( $q['m'] ) ? (int) $q['m'] : 0;

	$q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;

	$q['post_type'] = 'attachment';

	$post_type = get_post_type_object( 'attachment' );

	$states = 'inherit';

	if ( current_user_can( $post_type->cap->read_private_posts ) )

		$states .= ',private';



	$q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : $states;

	$media_per_page = (int) get_user_option( 'upload_per_page' );

	if ( empty( $media_per_page ) || $media_per_page < 1 )

		$media_per_page = 20;

	$q['posts_per_page'] = apply_filters( 'upload_per_page', $media_per_page );



	$post_mime_types = get_post_mime_types();

	$avail_post_mime_types = get_available_post_mime_types('attachment');



	if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) )

		unset($q['post_mime_type']);



	if ( isset($q['detached']) )

		add_filter('posts_where', '_edit_attachments_query_helper');



	wp( $q );



	if ( isset($q['detached']) )

		remove_filter('posts_where', '_edit_attachments_query_helper');



	return array($post_mime_types, $avail_post_mime_types);

}

3621