Useful Snippets

Welcome!


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at Unwanted.cloud

RSS Latest posts from my personal blog


Subscribe to RSS feed


Always display image edit and remove buttons in Advanced Custom Fields

Stanislav KhromovStanislav Khromov

I had an annoying usability problem with Advanced Custom Fields. Users of the system did not understand how to change or remove an already uploaded image, because the buttons to do so only show up after the user has hovered over the existing image, like this:

always-display-these

Here is a little snippet that you can add to your functions.php file in your theme to always display these buttons in the admin.

add_action('admin_footer', function()
{
    ?>
    <style type="text/css">
        .acf-image-uploader .hover
        {
            visibility: visible;
            opacity: 1;
        }
    </style>
    <?php
}, 999);

Full-stack impostor syndrome sufferer & Software Engineer at Schibsted Media Group

Comments 1
  • sujata
    Posted on

    sujata sujata

    Reply Author

    How to add these buttons without using ACF? without using plugin i want to add these buttons in my custom fields. How to do that?