WordPress.org

Make WordPress Core

Ticket #11241: show-do_action-warning.php

File show-do_action-warning.php, 823 bytes (added by chrisbliss18, 5 years ago)

This plugin enables warnings and produces the warning at the top of the screen.

Line 
1<?php
2
3/*
4Plugin Name: Show do_action warning
5Description: This is not just a plugin, it represents a constant frustration faced by Chris Jean for the past three months.
6Author: Chris Jean
7Version: 1.0.0
8Author URI: http://gaarai.com/
9*/
10
11error_reporting( E_ALL );
12ini_set( 'display_errors', 1 );
13
14add_action( 'do_nothing', 'this_does_nothing' );
15
16function this_does_nothing( $argument ) {
17        // Do nothing
18}
19
20$this_works_1 = 'value';
21$this_works_2 = array();
22$this_works_3 = array( '1', '2', '3' );
23$this_works_4 = (object) array( 'name' => 'value' );
24
25$produces_a_warning = array( 'name' => 'value' );
26
27do_action( 'do_nothing', $this_works_1 );
28do_action( 'do_nothing', $this_works_2 );
29do_action( 'do_nothing', $this_works_3 );
30do_action( 'do_nothing', $this_works_4 );
31do_action( 'do_nothing', $produces_a_warning );
32
33?>