Make WordPress Core

Changeset 34502


Ignore:
Timestamp:
09/24/2015 04:17:23 PM (9 years ago)
Author:
DrewAPicture
Message:

Docs: Add more explicit optional parameter types and return descriptions in the DocBlocks for is_page(), is_single(), is_singular().

Also adds explicit types and return descriptions to the corresponding WP_Query methods: WP_Query::is_page(), WP_Query::is_single(), and WP_Query::is_singular().

Props Shelob9 for the initial patch.
Fixes #33907.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r34366 r34502  
    489489 * @global WP_Query $wp_query Global WP_Query instance.
    490490 *
    491  * @param mixed $page Page ID, title, slug, or array of such.
    492  * @return bool
     491 * @param int|string|array $page Optional. Page ID, title, slug, or array of such. Default empty.
     492 * @return bool Whether the query is for an existing single page.
    493493 */
    494494function is_page( $page = '' ) {
     
    598598 * @global WP_Query $wp_query Global WP_Query instance.
    599599 *
    600  * @param mixed $post Post ID, title, slug, or array of such.
    601  * @return bool
     600 * @param int|string|array $post Optional. Post ID, title, slug, or array of such. Default empty.
     601 * @return bool Whether the query is for an existing single post.
    602602 */
    603603function is_single( $post = '' ) {
     
    625625 * @global WP_Query $wp_query Global WP_Query instance.
    626626 *
    627  * @param mixed $post_types Optional. Post Type or array of Post Types
    628  * @return bool
     627 * @param string|array $post_types Optional. Post type or array of post types. Default empty.
     628 * @return bool Whether the query is for an existing single post of any of the given post types.
    629629 */
    630630function is_singular( $post_types = '' ) {
     
    44074407     * @since 3.1.0
    44084408     *
    4409      * @param mixed $page Page ID, title, slug, path, or array of such.
    4410      * @return bool
     4409     * @param int|string|array $page Optional. Page ID, title, slug, path, or array of such. Default empty.
     4410     * @return bool Whether the query is for an existing single page.
    44114411     */
    44124412    public function is_page( $page = '' ) {
     
    45004500     * @since 3.1.0
    45014501     *
    4502      * @param mixed $post Post ID, title, slug, path, or array of such.
    4503      * @return bool
     4502     * @param int|string|array $post Optional. Post ID, title, slug, path, or array of such. Default empty.
     4503     * @return bool Whether the query is for an existing single post.
    45044504     */
    45054505    public function is_single( $post = '' ) {
     
    45464546     * @since 3.1.0
    45474547     *
    4548      * @param mixed $post_types Optional. Post Type or array of Post Types
    4549      * @return bool
     4548     * @param string|array $post_types Optional. Post type or array of post types. Default empty.
     4549     * @return bool Whether the query is for an existing single post of any of the given post types.
    45504550     */
    45514551    public function is_singular( $post_types = '' ) {
Note: See TracChangeset for help on using the changeset viewer.