Making WordPress.org


Ignore:
Timestamp:
05/30/2017 06:12:29 PM (7 years ago)
Author:
coreymckrill
Message:

WordCamp Post Types: Show sponsors post type in the v2 REST API

The v1 endpoint is now deprecated, so it needs to be available
in v2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php

    r5509 r5522  
    14271427
    14281428        wcorg_register_meta_only_on_endpoint( 'post', $public_session_fields, '/wp-json/wp/v2/sessions/' );
     1429
     1430        $public_sponsor_fields = array(
     1431            '_wcpt_sponsor_website' => array(
     1432                'single' => true,
     1433            )
     1434        );
     1435
     1436        wcorg_register_meta_only_on_endpoint( 'post', $public_sponsor_fields, '/wp-json/wp/v2/sponsors/' );
    14291437    }
    14301438
     
    20232031            'labels'            => $labels,
    20242032            'rewrite'           => array( 'slug' => 'sponsor', 'with_front' => false ),
    2025             'supports'          => array( 'title', 'editor', 'revisions', 'thumbnail' ),
     2033            'supports'          => array( 'title', 'editor', 'revisions', 'thumbnail', 'custom-fields' ),
    20262034            'menu_position'     => 21,
    20272035            'public'            => true,
     
    20322040            'query_var'         => true,
    20332041            'menu_icon'         => 'dashicons-heart',
     2042            'show_in_rest'      => true,
     2043            'rest_base'         => 'sponsors',
    20342044        ) );
    20352045
Note: See TracChangeset for help on using the changeset viewer.