The edit_link_category_form WordPress PHP action fires at the end of the Edit Link form and allows you to modify or add extra fields.
Usage
add_action('edit_link_category_form', 'your_custom_function'); function your_custom_function($arg) { // your custom code here }
Parameters
- $arg (object) – Arguments cast to an object.
More information
See WordPress Developer Resources: edit_link_category_form
Examples
Add a custom field to the form
Add a custom field “Extra Description” to the Edit Link Category form.
add_action('edit_link_category_form', 'add_extra_description_field'); function add_extra_description_field($arg) { // Add a new textarea for the extra description echo '<p><strong>Extra Description</strong><br>'; echo '<textarea name="extra_description" rows="5" cols="50"></textarea>'; echo '</p>'; }
Add a custom checkbox to the form
Add a custom checkbox “Enable Custom Feature” to the Edit Link Category form.
add_action('edit_link_category_form', 'add_custom_feature_checkbox'); function add_custom_feature_checkbox($arg) { // Add a new checkbox for the custom feature echo '<p><label><input type="checkbox" name="custom_feature" value="1"> <strong>Enable Custom Feature</strong></label></p>'; }
Add a custom field for an icon URL
Add a custom field “Icon URL” to the Edit Link Category form to include a custom icon for each link category.
add_action('edit_link_category_form', 'add_icon_url_field'); function add_icon_url_field($arg) { // Add a new text input for the icon URL echo '<p><strong>Icon URL</strong><br>'; echo '<input type="text" name="icon_url" size="50">'; echo '</p>'; }
Display a custom message
Display a custom message at the end of the Edit Link Category form.
add_action('edit_link_category_form', 'display_custom_message'); function display_custom_message($arg) { // Display a custom message echo '<p><strong>Note:</strong> Custom message goes here.</p>'; }
Add a custom dropdown to the form
Add a custom dropdown “Custom Selection” to the Edit Link Category form with three options.
add_action('edit_link_category_form', 'add_custom_selection_dropdown'); function add_custom_selection_dropdown($arg) { // Add a new dropdown for the custom selection echo '<p><strong>Custom Selection</strong><br>'; echo '<select name="custom_selection">'; echo '<option value="option1">Option 1</option>'; echo '<option value="option2">Option 2</option>'; echo '<option value="option3">Option 3</option>'; echo '</select>'; echo '</p>'; }