P
P
Polina Titova2021-07-06 13:47:07
WordPress
Polina Titova, 2021-07-06 13:47:07

How to upload an image to a wordpress site?

Function file:

add_action( 'after_setup_theme', 'theme_register_nav_menu' );
function theme_register_nav_menu() {
    add_theme_support( 'post-thumbnails', array( 'post' ) );
}

Post Image File:
<?php the_post_thumbnail('thumbnail') ?>

A new "Post Image" panel appears in post editing. We go into it, select the file and get an error: 60e433de681c1402015780.png

When adding a file to media files, it does not load with the same message. There may be a problem with permissions, but posts, pages, tags and categories are created. Why is it happening and how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Constantine, 2021-07-11
@poly-titova

To correctly upload files, you must give write access to the ./wp-content/uploads folder.
On the local machine, just execute chmod
chmod -R 777 ./wp-content/uploads

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question