Home › Forums › ACF PRO › Wysiwyg Editor – hooks for "Add Media" button? › Reply To: Wysiwyg Editor – hooks for "Add Media" button?
Thank you for taking a look into this! I had suspected that I should be focusing solely on WP hooks for this, and I have also been unsuccessful at finding the right one.
Since there doesn’t seem to be anything identifiable about a specific “Add Media” button, I should find a hook where the $_SERVER['HTTP_REFERER']
will point to the form’s page plus where I can access the attachment’s ID after it has been uploaded.
I’ve tried the ‘add_attachment‘ action but the referer is always media-new.php, then the ‘wp_handle_upload‘ filter doesn’t seem to provide a way to access the attachment’s ID, and ‘wp_handle_upload_prefilter‘ fires before the upload happens so no luck…
P.S.: Also many thanks for the aforementioned Image field solution. It was very useful for my projects.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.