remove_post_type_support example


function _disable_content_editor_for_navigation_post_type( $post ) {
    $post_type = get_post_type( $post );
    if ( 'wp_navigation' !== $post_type ) {
        return;
    }

    remove_post_type_support( $post_type, 'editor' );
}

/** * This callback enables content editor for wp_navigation type posts. * We need to enable it back because we disable it to hide * the content editor for wp_navigation type posts. * * @since 5.9.0 * @access private * * @see _disable_content_editor_for_navigation_post_type * * @param WP_Post $post An instance of WP_Post class. */

$post_ID = isset( $post_ID ) ? (int) $post_ID : 0;
$user_ID = isset( $user_ID ) ? (int) $user_ID : 0;
$action  = isset( $action ) ? $action : '';

if ( (int) get_option( 'page_for_posts' ) === $post->ID && empty( $post->post_content ) ) {
    add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
    remove_post_type_support( $post_type, 'editor' );
}

$thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' );
if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) {
    if ( wp_attachment_is( 'audio', $post ) ) {
        $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
    } elseif ( wp_attachment_is( 'video', $post ) ) {
        $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
    }
}

Home | Imprint | This part of the site doesn't use cookies.