| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | Plugin Name: Fix Custom Fields in WP 3.4.2 |
|---|
| 4 | Version: 0.1 |
|---|
| 5 | Plugin URI: http://core.trac.wordpress.org/ticket/21829 |
|---|
| 6 | Description: Implements a workaround for adding and updating custom fields in WordPress 3.4.2. |
|---|
| 7 | Author: Sergey Biryukov |
|---|
| 8 | Author URI: http://profiles.wordpress.org/sergeybiryukov/ |
|---|
| 9 | */ |
|---|
| 10 | |
|---|
| 11 | function fix_custom_fields_in_wp342() { |
|---|
| 12 | global $wp_version, $hook_suffix; |
|---|
| 13 | |
|---|
| 14 | if ( '3.4.2' == $wp_version && in_array( $hook_suffix, array( 'post.php', 'post-new.php' ) ) ) : ?> |
|---|
| 15 | <script type="text/javascript"> |
|---|
| 16 | jQuery(document).delegate( '#addmetasub, #updatemeta', 'hover focus', function() { |
|---|
| 17 | jQuery(this).attr('id', 'meta-add-submit'); |
|---|
| 18 | }); |
|---|
| 19 | </script> |
|---|
| 20 | <?php |
|---|
| 21 | endif; |
|---|
| 22 | } |
|---|
| 23 | add_action( 'admin_print_footer_scripts', 'fix_custom_fields_in_wp342' ); |
|---|
| 24 | ?> |
|---|