WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/12/17 12:53:21 (2 months ago)
Author:
adamsilverstein
Message:

Add wp.hooks - JavaScript actions and filters.

Add a JavaScript hooks library with an API that mirrors the WordPress Plugin API; provides similar functionality and API to PHP hooks.

Called via the global wp.hooks, eg: wp.hooks.addAction(), etc. Adds:

  • addAction( 'hook', 'vendor/plugin/function', callback, priority )
  • addFilter( 'hook', 'vendor/plugin/function', callback, priority )
  • removeAction( 'hook', 'vendor/plugin/function' )
  • removeFilter( 'hook', 'vendor/plugin/function' )
  • removeAllActions( 'hook' )
  • removeAllFilters( 'hook' )
  • doAction( 'hook', arg1, arg2, moreArgs, finalArg )
  • applyFilters( 'hook', content, arg1, arg2, moreArgs, finalArg )
  • doingAction( 'hook' )
  • doingFilter( 'hook' )
  • didAction( 'hook' )
  • didFilter( 'hook' )
  • hasAction( 'hook' )
  • hasFilter( 'hook' )

Props adamsilverstein, jnylen0, aduth, kadamwhite, youknowriad, schlessera, mikeschinkel, azaozz, vhauri, CaptainN, scribu, carldanley, chetanchauhan, mgibbs189, stephenharris, justnorris, koopersmith, gcorne, TV productions, atimmer.

Fixes #21170.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/plugin.php

    r41308 r41375  
    364364 
    365365/** 
    366  * Retrieve the name of an action currently being processed. 
     366 * Retrieve whether action currently being processed. 
    367367 * 
    368368 * @since 3.9.0 
Note: See TracChangeset for help on using the changeset viewer.