You appear to be a bot. Output may be restricted
Description
Update singular image state to turn featured image output on or off for the provided post types.
Expects to receive a JSON object with post type as key, then 1 for the value to enable images, and 0 to disable. {
- "pages": 0, // Disable featured images on pages.
- "posts": 1 // Enable featured images on posts.
}
Returns an array of all post types that now have featured images enabled after the update is applied. For the above example, assuming no other post types have genesis-singular-images
support:
[ "posts" ]
Usage
set_singular_images();
Parameters
Returns
void
Source
File name: genesis/lib/functions/rest.php
Lines:
1 to 25 of 25
function set_singular_images() { \register_rest_route( 'genesis/v1', '/singular-images', [ 'methods' => 'PUT', 'callback' => function( $request ) { $post_types = $request->get_json_params(); foreach ( $post_types as $type => $value ) { $genesis_options = get_option( GENESIS_SETTINGS_FIELD ); $genesis_options[ "show_featured_image_{$type}" ] = $value; update_option( GENESIS_SETTINGS_FIELD, $genesis_options ); } return \genesis_post_types_with_singular_images_enabled(); }, 'permission_callback' => function() { return current_user_can( 'edit_theme_options' ); }, ] ); }