Make WordPress Core


Ignore:
Timestamp:
10/15/2018 11:45:16 AM (6 years ago)
Author:
flixos90
Message:

REST API: Move object type-specific metadata integrations from the wrapper functions to the low-level Meta API functions.

Object type-specific actions that should happen before or after modification of metadata have so far been part of the respective wrapper functions. By using action and filter hooks, this changeset ensures they are always executed, even when calling the lower-level Meta API functions directly, which the REST API does as a prime example.

Props flixos90, spacedmonkey.
Fixes #44467.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-includes/default-filters.php

    r43502 r43729  
    8989// Meta
    9090add_filter( 'register_meta_args', '_wp_register_meta_args_whitelist', 10, 2 );
     91
     92// Post meta
     93add_action( 'added_post_meta', 'wp_cache_set_posts_last_changed' );
     94add_action( 'updated_post_meta', 'wp_cache_set_posts_last_changed' );
     95add_action( 'deleted_post_meta', 'wp_cache_set_posts_last_changed' );
     96
     97// Term meta
     98add_action( 'added_term_meta', 'wp_cache_set_terms_last_changed' );
     99add_action( 'updated_term_meta', 'wp_cache_set_terms_last_changed' );
     100add_action( 'deleted_term_meta', 'wp_cache_set_terms_last_changed' );
     101add_filter( 'get_term_metadata', 'wp_check_term_meta_support_prefilter' );
     102add_filter( 'add_term_metadata', 'wp_check_term_meta_support_prefilter' );
     103add_filter( 'update_term_metadata', 'wp_check_term_meta_support_prefilter' );
     104add_filter( 'delete_term_metadata', 'wp_check_term_meta_support_prefilter' );
     105add_filter( 'get_term_metadata_by_mid', 'wp_check_term_meta_support_prefilter' );
     106add_filter( 'update_term_metadata_by_mid', 'wp_check_term_meta_support_prefilter' );
     107add_filter( 'delete_term_metadata_by_mid', 'wp_check_term_meta_support_prefilter' );
     108add_filter( 'update_term_metadata_cache', 'wp_check_term_meta_support_prefilter' );
     109
     110// Comment meta
     111add_action( 'added_comment_meta', 'wp_cache_set_comments_last_changed' );
     112add_action( 'updated_comment_meta', 'wp_cache_set_comments_last_changed' );
     113add_action( 'deleted_comment_meta', 'wp_cache_set_comments_last_changed' );
    91114
    92115// Places to balance tags on input
Note: See TracChangeset for help on using the changeset viewer.