暫無描述

functions.php 912B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Legacy global scope functions.
  4. *
  5. * @package automattic/jetpack-compat
  6. */
  7. // If WordPress's plugin API is available already, use it. If not,
  8. // drop data into `$wp_filter` for `WP_Hook::build_preinitialized_hooks()`.
  9. if ( function_exists( 'add_filter' ) ) {
  10. $add_filter = 'add_filter';
  11. $add_action = 'add_action';
  12. } else {
  13. $add_filter = function ( $name, $cb, $priority = 10, $accepted_args = 1 ) {
  14. global $wp_filter;
  15. // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
  16. $wp_filter[ $name ][ $priority ][] = array(
  17. 'accepted_args' => $accepted_args,
  18. 'function' => $cb,
  19. );
  20. };
  21. $add_action = $add_filter;
  22. }
  23. /**
  24. * Load necessary functions.
  25. */
  26. function jetpack_compat_require_defined_functions() {
  27. require_once __DIR__ . '/lib/tracks/client.php';
  28. }
  29. $add_action( 'plugins_loaded', 'jetpack_compat_require_defined_functions' );