wp_edit_attachments_query

函式
wp_edit_attachments_query ( $q = false )
引數
  • (array|false) $q Optional. Array of query variables to use to build the query. Defaults to the `$_GET` superglobal.
    Required:
    Default: false
返回值
  • (array)
定義位置
相關方法
wp_edit_attachments_query_varswp_get_attachment_urlwp_get_attachment_id3_keyswp_get_attachment_imagewp_get_attachment_image_src
引入
2.5.0
棄用
-

wp_edit_attachments_query: 當在WordPress媒體庫中構建附件的查詢時,這個鉤子被觸發。這個鉤子可以用來修改查詢引數以定製顯示的附件列表。

執行對附件的查詢。一個WP_Query的引數陣列可以被傳入,它將覆蓋這個函式所設定的引數。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_edit_attachments_query( $q = false ) {
wp( wp_edit_attachments_query_vars( $q ) );
$post_mime_types = get_post_mime_types();
$avail_post_mime_types = get_available_post_mime_types( 'attachment' );
return array( $post_mime_types, $avail_post_mime_types );
}
function wp_edit_attachments_query( $q = false ) { wp( wp_edit_attachments_query_vars( $q ) ); $post_mime_types = get_post_mime_types(); $avail_post_mime_types = get_available_post_mime_types( 'attachment' ); return array( $post_mime_types, $avail_post_mime_types ); }
function wp_edit_attachments_query( $q = false ) {
	wp( wp_edit_attachments_query_vars( $q ) );

	$post_mime_types       = get_post_mime_types();
	$avail_post_mime_types = get_available_post_mime_types( 'attachment' );

	return array( $post_mime_types, $avail_post_mime_types );
}

常見問題

FAQs
檢視更多 >