Make WordPress Core


Ignore:
Timestamp:
01/24/2025 01:30:27 PM (4 months ago)
Author:
swissspidy
Message:

Posts, Post Types: Embeds: Add new embeddable argument to post types.

This new argument, which defaults to the value of public, can be used to determine whether a post can be embedded using oEmbed. A new is_post_embeddable() function is added to easily check this.

Props pampfelimetten, swissspidy, bradleyt, DrewAPicture, gadelhas, mukesh27.
Fixes #35567.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-post-type.php

    r59161 r59700  
    113113     */
    114114    public $publicly_queryable = null;
     115
     116    /**
     117     * Whether this post type is embeddable.
     118     *
     119     * Default is the value of $public.
     120     *
     121     * @since 6.8.0
     122     * @var bool $embeddable
     123     */
     124    public $embeddable = null;
    115125
    116126    /**
     
    522532            'exclude_from_search'             => null,
    523533            'publicly_queryable'              => null,
     534            'embeddable'                      => null,
    524535            'show_ui'                         => null,
    525536            'show_in_menu'                    => null,
     
    564575        if ( null === $args['show_ui'] ) {
    565576            $args['show_ui'] = $args['public'];
     577        }
     578
     579        // If not set, default to the setting for 'public'.
     580        if ( null === $args['embeddable'] ) {
     581            $args['embeddable'] = $args['public'];
    566582        }
    567583
Note: See TracChangeset for help on using the changeset viewer.