Invalid form submission in wordpress

a 夏天 提交于 2020-01-22 18:57:12

问题


I have a wordpress based classifieds site, i am trying to create and xml feed application that fetches xml from other sites and create ads. I am able to create post in wordpress from the feeds. But i cant copy the images from the remote server,there are no permission issues, i am using the worpress function wp_handle_upload_error, But i get error

This the code

   public function xml_image_upload($upload)
    {
        if ($this->xml_file_is_image($upload['tmp_name'])) 
            {
                $file = wp_handle_upload($upload, $overrides);
            }
    return $file;
    } 

The error i get is "Invalid form submission"

I am trying to solve this for a long time. I cant figure out whats wrong..


回答1:


You need to pass array('test_form' => FALSE) as the second parameter or the upload will be rejected for some reason. See http://codex.wordpress.org/Function_Reference/wp_handle_upload#Parameters




回答2:


Second parameter of wp_handle_upload is important.

Use array('action' => 'name_of_your_action') (without prefix admin_post_ or wp_ajax_).



来源:https://stackoverflow.com/questions/8019761/invalid-form-submission-in-wordpress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!