get_previous_comments_link

Definition:
function get_previous_comments_link( $label = '' ) {}

Return the previous comments page link.

Parameters

  • string $label: Optional. Label for comments link text.

Defined filters

  • previous_comments_link_attributes
    apply_filters( 'previous_comments_link_attributes', '' )

Source code

function get_previous_comments_link( $label = '' ) {

	if ( !is_singular() || !get_option('page_comments') )

		return;



	$page = get_query_var('cpage');



	if ( intval($page) <= 1 )

		return;



	$prevpage = intval($page) - 1;



	if ( empty($label) )

		$label = __('&laquo; Older Comments');



	return '<a href="' . esc_url( get_comments_pagenum_link( $prevpage ) ) . '" ' . apply_filters( 'previous_comments_link_attributes', '' ) . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&$1', $label) .'</a>';

}

1638

get_preferred_from_update_core

Definition:
function get_preferred_from_update_core() {}

Selects the first update version from the update_core option

Return values

returns:response from the API

Source code

function get_preferred_from_update_core() {

	$updates = get_core_updates();

	if ( !is_array( $updates ) )

		return false;

	if ( empty( $updates ) )

		return (object)array('response' => 'latest');

	return $updates[0];

}

1636

get_post_type_object

Definition:
function get_post_type_object( $post_type ) {}

Retrieve a post type object by name

Parameters

  • string $post_type: The name of a registered post type

Return values

returns:post type object

Source code

function get_post_type_object( $post_type ) {

	global $wp_post_types;



	if ( empty($wp_post_types[$post_type]) )

		return null;



	return $wp_post_types[$post_type];

}

1633

get_post_type_labels

Definition:
function get_post_type_labels( $post_type_object ) {}

Builds an object with all post type labels out of a post type object
Accepted keys of the label array in the post type object:

Parameters

  • object $post_type_object

Return values

returns:with all the labels as member variables

Source code

function get_post_type_labels( $post_type_object ) {

	$nohier_vs_hier_defaults = array(

		'name' => array( _x('Posts', 'post type general name'), _x('Pages', 'post type general name') ),

		'singular_name' => array( _x('Post', 'post type singular name'), _x('Page', 'post type singular name') ),

		'add_new' => array( _x('Add New', 'post'), _x('Add New', 'page') ),

		'add_new_item' => array( __('Add New Post'), __('Add New Page') ),

		'edit_item' => array( __('Edit Post'), __('Edit Page') ),

		'new_item' => array( __('New Post'), __('New Page') ),

		'view_item' => array( __('View Post'), __('View Page') ),

		'search_items' => array( __('Search Posts'), __('Search Pages') ),

		'not_found' => array( __('No posts found.'), __('No pages found.') ),

		'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ),

		'parent_item_colon' => array( null, __('Parent Page:') ),

		'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) )

	);

	$nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];

	return _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );

}

1631

get_post_type_capabilities

Definition:
function get_post_type_capabilities( $args ) {}

Builds an object with all post type capabilities out of a post type object
Post type capabilities use the ‘capability_type’ argument as a base, if the capability is not set in the ‘capabilities’ argument array or if the ‘capabilities’ argument is not supplied.

Parameters

  • object $args: Post type registration arguments

Return values

returns:with all the capabilities as member variables

Source code

function get_post_type_capabilities( $args ) {

	if ( ! is_array( $args->capability_type ) )

		$args->capability_type = array( $args->capability_type, $args->capability_type . 's' );



	// Singular base for meta capabilities, plural base for primitive capabilities.

	list( $singular_base, $plural_base ) = $args->capability_type;



	$default_capabilities = array(

		// Meta capabilities

		'edit_post'          => 'edit_'         . $singular_base,

		'read_post'          => 'read_'         . $singular_base,

		'delete_post'        => 'delete_'       . $singular_base,

		// Primitive capabilities used outside of map_meta_cap():

		'edit_posts'         => 'edit_'         . $plural_base,

		'edit_others_posts'  => 'edit_others_'  . $plural_base,

		'publish_posts'      => 'publish_'      . $plural_base,

		'read_private_posts' => 'read_private_' . $plural_base,

	);



	// Primitive capabilities used within map_meta_cap():

	if ( $args->map_meta_cap ) {

		$default_capabilities_for_mapping = array(

			'read'                   => 'read',

			'delete_posts'           => 'delete_'           . $plural_base,

			'delete_private_posts'   => 'delete_private_'   . $plural_base,

			'delete_published_posts' => 'delete_published_' . $plural_base,

			'delete_others_posts'    => 'delete_others_'    . $plural_base,

			'edit_private_posts'     => 'edit_private_'     . $plural_base,

			'edit_published_posts'   => 'edit_published_'   . $plural_base,

		);

		$default_capabilities = array_merge( $default_capabilities, $default_capabilities_for_mapping );

	}



	$capabilities = array_merge( $default_capabilities, $args->capabilities );



	// Remember meta capabilities for future reference.

	if ( $args->map_meta_cap )

		_post_type_meta_capabilities( $capabilities );



	return (object) $capabilities;

}

1628