| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | // See http://core.trac.wordpress.org/ticket/22342
|
|---|
| 4 |
|
|---|
| 5 | test_22342();
|
|---|
| 6 |
|
|---|
| 7 | function test_22342() {
|
|---|
| 8 |
|
|---|
| 9 | $post_id = 5; // Set this to some real post ID.
|
|---|
| 10 |
|
|---|
| 11 | update_post_meta( $post_id, '_test_22342', array( 'foo' => 'bar' ) );
|
|---|
| 12 |
|
|---|
| 13 | $meta_value = get_post_meta( 'post_id', '_test_22342', true );
|
|---|
| 14 |
|
|---|
| 15 | var_dump( $meta_value ); // bool(false)
|
|---|
| 16 |
|
|---|
| 17 | // Clean up.
|
|---|
| 18 | delete_post_meta( $post_id, '_test_22342' );
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | function filter_postmeta_22342( $check, $post_id, $meta_key, $single ) {
|
|---|
| 22 |
|
|---|
| 23 | if ( '_test_22342' == $meta_key )
|
|---|
| 24 | return array( 'foo' => 'test' );
|
|---|
| 25 | }
|
|---|
| 26 | add_filter( 'get_post_metadata', 'filter_postmeta_22342', 10, 4 );
|
|---|