Making WordPress.org

Changeset 2245


Ignore:
Timestamp:
01/04/2016 03:47:12 PM (10 years ago)
Author:
iandunn
Message:

WordCamp JSON API: Organize callback registration at the top of the file.

This makes it easier to get an overview of all of the callbacks, and to disable them during debugging and development.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wcorg-json-api.php

    r2241 r2245  
    1414 */
    1515
     16add_filter( 'json_endpoints',              'wcorg_json_whitelist_endpoints',             999    );
     17add_filter( 'json_prepare_post',           'wcorg_json_expose_whitelisted_meta_data',    997, 3 );
     18add_filter( 'json_prepare_post',           'wcorg_json_expose_additional_post_data',     998, 3 );   // after `wcorg_json_expose_whitelisted_meta_data()`, because anything added before that method gets wiped out
     19add_filter( 'json_prepare_post',           'wcorg_json_embed_related_posts',             999, 3 );   // after `wcorg_json_expose_additional_post_data()`
     20add_action( 'wp_json_server_before_serve', 'wcorg_json_avoid_nested_callback_conflicts', 11     );    // after the default endpoints are added in `json_api_default_filters()`
     21add_filter( 'wp_cache_eof_tags',           'wcorg_json_cache_requests'                          );
    1622
    1723/**
     
    7177    return $whitelisted_endpoints;
    7278}
    73 add_filter( 'json_endpoints', 'wcorg_json_whitelist_endpoints', 999 );
    7479
    7580/**
     
    125130    return $prepared_post;
    126131}
    127 add_filter( 'json_prepare_post', 'wcorg_json_expose_whitelisted_meta_data', 997, 3 );
    128132
    129133/**
     
    153157    return $prepared_post;
    154158}
    155 add_filter( 'json_prepare_post', 'wcorg_json_expose_additional_post_data', 998, 3 );   // after `wcorg_json_expose_whitelisted_meta_data()`, because anything added before that method gets wiped out
    156159
    157160/**
     
    214217    return $prepared_post;
    215218}
    216 add_filter( 'json_prepare_post', 'wcorg_json_embed_related_posts', 999, 3 );   // after `wcorg_json_expose_additional_post_data()`
    217219
    218220/**
     
    303305    remove_filter( 'json_prepare_post', array( $wp_json_media, 'add_thumbnail_data' ), 10, 3 );
    304306}
    305 add_action( 'wp_json_server_before_serve', 'wcorg_json_avoid_nested_callback_conflicts', 11 );    // after the default endpoints are added in `json_api_default_filters()`
    306307
    307308/**
     
    332333    return $eof_pattern;
    333334}
    334 add_filter( 'wp_cache_eof_tags', 'wcorg_json_cache_requests' );
Note: See TracChangeset for help on using the changeset viewer.