I am trying to import demo content in my installed theme, but every time I try to import data by uploading the XML/JSON file, it throws an error.
I get this error while trying to import a widget file from the Tools->Widget Importer and Exports->uploading a .wie file
.
I get this error while uploading demo content through a plugin One Click Demo Import.
It has two option
Is click on upload button and then it automatically uploads the files.
Is to uploading files manually (XML,JSON files).
When I do 2nd option, it sometimes gives a success message, but no changes reflect in theme or anywhere (If the data imports successfully, it creates demo pages which shows in Pages menu[worked on localhost]).
I am having this issue on the server (AWS Linux 2), everything is working fine on localhost. I have made some changes in the php.ini
file also but didn't work (changed default values with this values).
upload_max_filesize (256M)
max_input_time (300)
memory_limit (256M)
max_execution_time (300)
post_max_size (512M)
Please suggest what else I can try.
This problem can have many causes.
First, do you have enough space in your server?
Second, can be due to wrong permissions in the wp-content. In order to fix it, recursively change group permissions of the folders and sub-folders of wp-content to enable write permissions and change file permissions to 664.
If you're using FileZilla, just FTP to that server, right click in the folder, go to permissions and set it to 775 and apply recursively to subdirectories only. For the files, make sure they have 664 by recursively changing the permissions of files only.
If you want to use a terminal, inside of wp-content:
find . -type d -exec chmod -R 775 {} \;
find . -type f -exec chmod -R 664 {} \;
Thirdly, If you still see the error, then you will need to empty the temporary files directory.
WordPress uploads your images using PHP which first saves the uploads to a temporary directory on your web server. After that it moves them to your WordPress uploads folder.
If this temporary directory is full or is poorly configured, then WordPress will not be able to write the file to disk.
If you have no idea where to find this folder, check: https://developer.wordpress.org/reference/functions/get_temp_dir/ . This method will allow you to reach that location. You can also check 'upload_tmp_dir' in php.ini.
If no location is defined (which is very unlikely) you need to paste this code to the wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging’.
define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/');
Next, you need to go to wp-content/ folder and create a new folder inside it. You need to name this new folder temp.
Fourthly, check this other answer on stack: https://stackoverflow.com/a/16091596/5675325