• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress develop tests

WordPress develop tests

WordPress develop tests a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / tests_add_filter() – Adds hooks before loading WP.

Description

Adds hooks before loading WP.

Usage

$true = tests_add_filter( $tag, $function_to_add, $priority, $accepted_args );

Parameters

$tag
( string ) required – The name of the filter to hook the $function_to_add callback to.
$function_to_add
( callable ) required – The callback to be run when the filter is applied.
$priority
( int ) optional default: 10 – Optional. Used to specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. Default 10.
$accepted_args
( int ) optional default: 1 – Optional. The number of arguments the function accepts. Default 1.

Returns

true

Source

File name: wordpress-develop-tests/phpunit/includes/functions.php


Lines:

1 to 16 of 16
function tests_add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
  global $wp_filter;

  if ( function_exists( 'add_filter' ) ) {
    add_filter( $tag, $function_to_add, $priority, $accepted_args );
  } else {
    $idx = _test_filter_build_unique_id( $tag, $function_to_add, $priority );

    $wp_filter[ $tag ][ $priority ][ $idx ] = array(
      'function'      => $function_to_add,
      'accepted_args' => $accepted_args,
    );
  }
  return true;
}
 

 View on GitHub

Called by

1 to 3 of 3
  • phpunit/includes/bootstrap.php
  • phpunit/includes/functions.php
  • phpunit/includes/install.php

Invoked by

    Calls

    1 to 2 of 2
    • _test_filter_build_unique_id() – Generates a unique function ID based on the given arguments.
    • tests_add_filter() – Adds hooks before loading WP.

    Call hooks

    Function name: tests_add_filter
    Plugin ref: WordPress develop tests
    Version: 5.9.3
    Sourcefile: phpunit/includes/functions.php
    File ref: phpunit/includes/functions.php
    Deprecated?: No
    API Letters: A,F,T

    Published: 26th November 2019 | Last updated: 20th March 2022

    Primary Sidebar

    Information

    Function name: tests_add_filter
    Plugin ref: WordPress develop tests
    Version: 5.9.3
    Sourcefile: phpunit/includes/functions.php
    File ref: phpunit/includes/functions.php
    Deprecated?: No
    API Letters: A,F,T

    Footer

    WordPress develop tests
    WordPress develop tests
    WordPress develop tests a2z
    WordPress 6.3.1
    WordPress a2z
    WordPress core a2z
    Genesis Theme Framework a2z
    Jetpack a2z
    WordPress develop tests
    Easy Digital Downloads a2z
    WooCommerce a2z
    Yoast SEO a2z
    WordPress Blocks

    Site:  develop.wp-a2z.org
    © Copyright WordPress develop tests 2014-2023. All rights reserved.


    Website designed and developed by Herb Miller
    Proudly powered by WordPress and oik plugins

    • Home
    • Blog
    • Sitemap
    • Sites