| 1 | <?php
|
|---|
| 2 | /*
|
|---|
| 3 | Plugin Name: Doing It Wrong
|
|---|
| 4 | Version: 0.1
|
|---|
| 5 | Plugin URI: http://core.trac.wordpress.org/ticket/14024
|
|---|
| 6 | Description: Sample plugin to test the issues brought up in #14024 and #11526
|
|---|
| 7 | Author: Sergey Biryukov
|
|---|
| 8 | Author URI: http://profiles.wordpress.org/sergeybiryukov/
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | /**
|
|---|
| 12 | * Call wp_get_current_user() too early
|
|---|
| 13 | *
|
|---|
| 14 | * Current user information is only available on init action or later.
|
|---|
| 15 | *
|
|---|
| 16 | * @link http://core.trac.wordpress.org/ticket/14024
|
|---|
| 17 | */
|
|---|
| 18 | function diw_get_current_user_too_early() {
|
|---|
| 19 | wp_get_current_user();
|
|---|
| 20 | }
|
|---|
| 21 | add_action('plugins_loaded', 'diw_get_current_user_too_early');
|
|---|
| 22 |
|
|---|
| 23 | /**
|
|---|
| 24 | * Call wp_register_script() too early
|
|---|
| 25 | *
|
|---|
| 26 | * Scripts and styles should not be registered or enqueued until
|
|---|
| 27 | * the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks.
|
|---|
| 28 | *
|
|---|
| 29 | * @link http://core.trac.wordpress.org/ticket/11526
|
|---|
| 30 | */
|
|---|
| 31 | function diw_register_script_too_early() {
|
|---|
| 32 | wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js' );
|
|---|
| 33 | }
|
|---|
| 34 | add_action('plugins_loaded', 'diw_register_script_too_early');
|
|---|
| 35 | ?>
|
|---|