mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
Move some post and taxonomy functions from admin/includes to wp-includes in preparation for QuickPress template tag. Moves get_tags_to_edit, get_terms_to_edit, get_default_post_to_edit, media_buttons, _media_button, get_upload_iframe_src. Also introduce get_media_buttons as a wrapper for media_buttons. props jorbin, see #14966.
git-svn-id: https://develop.svn.wordpress.org/trunk@15688 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2821,3 +2821,46 @@ function get_ancestors($object_id = 0, $object_type = '') {
|
||||
|
||||
return apply_filters('get_ancestors', $ancestors, $object_id, $object_type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
*
|
||||
* @since unknown
|
||||
*
|
||||
* @param unknown_type $post_id
|
||||
* @return unknown
|
||||
*/
|
||||
function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) {
|
||||
return get_terms_to_edit( $post_id, $taxonomy);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
*
|
||||
* @since unknown
|
||||
*
|
||||
* @param unknown_type $post_id
|
||||
* @return unknown
|
||||
*/
|
||||
function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
|
||||
$post_id = (int) $post_id;
|
||||
if ( !$post_id )
|
||||
return false;
|
||||
|
||||
$tags = wp_get_post_terms($post_id, $taxonomy, array());
|
||||
|
||||
if ( !$tags )
|
||||
return false;
|
||||
|
||||
if ( is_wp_error($tags) )
|
||||
return $tags;
|
||||
|
||||
foreach ( $tags as $tag )
|
||||
$tag_names[] = $tag->name;
|
||||
$tags_to_edit = join( ',', $tag_names );
|
||||
$tags_to_edit = esc_attr( $tags_to_edit );
|
||||
$tags_to_edit = apply_filters( 'terms_to_edit', $tags_to_edit, $taxonomy );
|
||||
|
||||
return $tags_to_edit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user