
如何修复MAMP“建立数据库连接时出错”
wp_embed_defaults ( $url = '' )
wp_embed_defaults: 这个过滤器是用来修改WordPress oEmbed系统的默认选项的。oEmbed系统是用来将第三方网站的媒体嵌入到WordPress的文章和页面中,这个过滤器可以用来定制oEmbed系统的行为。
创建默认的嵌入参数数组。
宽度默认为主题所指定的内容宽度。如果主题没有指定内容的宽度,那么就使用500px。
默认高度是宽度的1.5倍,或1000px,以较小者为准。
{@see ’embed_defaults’}过滤器可以用来调整这些值中的任何一个。
function wp_embed_defaults( $url = '' ) { if ( ! empty( $GLOBALS['content_width'] ) ) { $width = (int) $GLOBALS['content_width']; } if ( empty( $width ) ) { $width = 500; } $height = min( ceil( $width * 1.5 ), 1000 ); /** * Filters the default array of embed dimensions. * * @since 2.9.0 * * @param int[] $size { * Indexed array of the embed width and height in pixels. * * @type int $0 The embed width. * @type int $1 The embed height. * } * @param string $url The URL that should be embedded. */ return apply_filters( 'embed_defaults', compact( 'width', 'height' ), $url ); }