I'm using some code so that form uploads appear in the media library (https://formidableforms.com/knowledgebase/file-upload/#kb-prevent-filtering-of-form-uploads), but I'm wondering if anyone has managed to do this for a specific form instead of for all forms. Any help or tips would be appreciated.
Thanks!
The pre_get_posts action is a WordPress hook that fires after the query variable object is created, but before the actual query is run. You may not be able to detect the form in use on the page with this action unless the form_id is embedded in the query variable object. This means you have to examine the object to see what it contains. If the form ID is is in the query object, you can use a conditional statement to wrap the remove action statement.
Alternatively, you can use a standard WordPress conditional to wrap this action based on the page/post the form is embedded within. See these articles:
https://developer.wordpress.org/reference/hooks/pre_get_posts/
https://developer.wordpress.org/reference/functions/is_page/
Please login or Register to submit your answer