1

How do you hide the "Delete Note" link in the Order Notes panel? Is there a hook that can be used?

Sample order note

0

You can try adding this in your functions.php file:

add_action('admin_head', 'hide_delete_note_from_edit_order');
function hide_delete_note_from_edit_order()
{
    $screen = get_current_screen();
    if ($screen->post_type === "shop_order" && $screen->base === "post") {
        echo '<style>a.delete_note { display:none; }</style>';
    }
}
1
  • I just removed $screen and the condition below it to make it simple. Thank you again.
    – wptent
    Jan 29 '20 at 1:28
1

The answer given by Dharmishtha Patel is a good method to use. Another method requiring less processing is the "Additional CSS" functionality.

Within your Dashboard select "Appearance | Customize | Additional CSS" to display an edit box.

If the style you want to change is a.delete_note type the following;

.a.delete_note { display: none; }

or perhaps

a.delete_note { display: none }

This method can be used for hiding many elements and overrides existing css styles.

More information can be found here.

3
  • I think the custom css doesn't affect the admin panel.
    – wptent
    Jan 29 '20 at 1:29
  • @wptent Sorry, I was unaware this was within the admin panel. :( Having said that, the css options are good for hiding other things on your blog and perhaps you can use it for something else. :) Good luck. Jan 29 '20 at 1:37
  • All good. thank you nonetheless.
    – wptent
    Jan 30 '20 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.