[wp-trac] [WordPress Trac] #53214: Register Menu Item Custom Field
WordPress Trac
noreply at wordpress.org
Mon Jul 15 21:58:58 UTC 2024
#53214: Register Menu Item Custom Field
--------------------------------------------+------------------------------
Reporter: mortezayung | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version: 1.0
Severity: normal | Resolution:
Keywords: wp_nav_menu_item_custom_fields | Focuses:
--------------------------------------------+------------------------------
Changes (by techfree):
* keywords: => wp_nav_menu_item_custom_fields
* type: defect (bug) => enhancement
* version: => 1.0
* component: Menus => Widgets
Comment:
@@ -1,7 +1,14 @@
function custom_field( $item_id, $item, $depth ) {
if ( $depth == 0 ) { ?>
<p class="description description-wide">
- Hello World
+ Hello Universe
</p>
+ <p class="field-custom description description-wide">
+ <label for="edit-menu-item-custom-<?php echo $item_id; ?>">
+ <?php _e( 'Custom Field' ); ?><br />
+ <input type="text" id="edit-menu-item-custom-<?php echo
$item_id; ?>" class="widefat edit-menu-item-custom" name="menu-item-
custom[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->custom
); ?>" />
+ </label>
+ </p>
<?php }
}
add_action( 'wp_nav_menu_item_custom_fields', 'custom_field', 10, 3 );
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53214#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list