WordPress.org

Make WordPress Core

Ticket #46586: plugin-a.php

File plugin-a.php, 398 bytes (added by Tyrannous, 8 months ago)

Plugin A. It's determine_current_user filter will never be executed if Plugin B is active.

Line 
1<?php declare(strict_types=1); // -*- coding: utf-8 -*-
2
3/**
4 * Plugin Name: Plugin A
5 */
6
7add_action(
8    'plugins_loaded',
9    function() {
10        add_filter(
11            'determine_current_user',
12            function($user_id) {
13                // Do something here with $user_id.
14                return $user_id;
15            }
16        );
17        $user = wp_get_current_user();
18    },
19    5
20);