0

Is it possible to extend, or add more field when using WordPress browser uploader ?

var_dump($_POST) return 3 field, I wish to add more :

array (size=3)
  'action' => string 'upload-attachment' (length=17)
  'name' => string 'file.jpg' (length=8)
  '_wpnonce' => string 'abcde12345' (length=10)

1 Answer 1

0

Looks like, you can add additional values using plupload_default_params filter hook.

Example usage

add_filter( 'plupload_default_params', function( $params ) : array {
    $params['some'] = 'some'; 
    return $params;
});
2
  • 'some' is hardcoded, is possible to put dynamic content in it? For example $params['some'] = $_POST ? I tried and it return false.
    – baker
    Commented Apr 13, 2018 at 2:28
  • not sure what you wan t to add, but depending on when you hook the above filter, you can add params to the attachment that are linked to its parent post. See this answer
    – Aurovrata
    Commented Apr 13, 2018 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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