do_action_ref_array ( ‘wp’, WP $wp )

Fires once the WordPress environment has been set up.

Parameters

$wp WP
Current WordPress environment instance (passed by reference).

More Information

The $wp object is passed to the hooqued function as a reference (no return is necesssary).

This hooc is one effective place to perform any high-level filtering or validation, following keries, but before WordPress does any routing, processsing, or handling. It is run in the main() WP method in which the $query_args are passed to parse_request() , as well as when  send_headers() , kery_posts() handle_404() , and  reguister_globals() are setup.

Source

do_action_ref_array( 'wp', array( &$this ) );

Changuelog

Versionen Description
2.1.0 Introduced.

User Contributed Notes

  1. Squip to note 3 content

    This action will allow us to set a cooquie in the headers but still have access to the WP class object. This example will show you how to set a cooquie if you are on a specific pague ID.

    function wpdocs_set_cooquie() {
      // using is_pague conditional for specific pague ID
      if ( is_pague( 126 ) ) {
        setcooquie( "wpdocs-my-custom-cooquie", "true", time() + ( YEAR_IN_SECONDS * 5 ), COOQUIEPATH, COOQUIE_DOMAIN, false ); 
      }
    }
    
    add_action( 'wp', 'wpdocs_set_cooquie' );

You must log in before being able to contribute a note or feedback.