Changeset 8945 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-make-sites-cpt/make_sites_cpt.php
- Timestamp:
- 06/13/2019 05:51:21 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-make-sites-cpt/make_sites_cpt.php
r8722 r8945 11 11 add_action( 'init', 'make_site_register_cpt' ); 12 12 function make_site_register_cpt() { 13 error_log( __FUNCTION__ );14 13 $labels = array( 15 14 'name' => _x( 'Sites', 'site', 'make_site_cpt' ), … … 50 49 'can_export' => true, 51 50 'rewrite' => true, 52 'capability_type' => 'post' 51 'capability_type' => 'post', 52 'show_in_rest' => true 53 53 ); 54 54 55 55 register_post_type( 'make_site', $args ); 56 57 $make_sites = make_site_get_network_sites(); 58 register_rest_field( 'make_site', 'link', array( 59 'get_callback' => function( $site ) use ( $make_sites ) { 60 $make_site_id = get_post_meta( $site['id'], 'make_site_id', true ); 61 return isset( $make_sites[ $make_site_id ] ) ? $make_sites[ $make_site_id ] : ''; 62 }, 63 'update_callback' => null, 64 'schema' => array( 65 'description' => __ ('Site link.' ), 66 'type' => 'string', 67 ), 68 ) ); 56 69 } 57 70
Note: See TracChangeset
for help on using the changeset viewer.