Root's "Change default upload location from wp-content/uploads" not working

Did you check access rights for media folder and access rights for images, must be owned by www-data:www-data. Sorry, but I have to ask.

Put this in templates/single-page.php and open page and postback results,

<?php while (have_posts()) : the_post(); ?>
  <?php echo '<p>WP_CONTENT_URL:'.WP_CONTENT_URL.'</p>'; ?>
  <?php echo '<p>WP_CONTENT_DIR:'.WP_CONTENT_DIR.'</p>'; ?>
  <?php echo '<p>UPLOAD_PATH:'.get_option( 'upload_path' ).'</p>'; ?> 
  <?php echo '<p>UPLOAD_URL_PATH:'.get_option( 'upload_url_path' ).'</p>'; ?> 
  <?php the_content(); ?>
  <?php wp_link_pages(array('before' => '<nav class="pagination">', 'after' => '</nav>')); ?>
<?php endwhile; ?>

I don’t know what you mean by “must be owned by www-data:www-data” ?

I made a new php file entitled single-page.php, and when accessed it returns:

Fatal error: Call to undefined function have_posts() in
/home/mysite/public_html/wp-content/themes/mytheme/templates/single-page.php
on line 1

I do not know how your os and apache is set up but all files that use by apache must be under his ownership and that is “www-data”. File I send you is original roots file with four lines added, the reason that apache reports error is that when you change/replace it you change/replace ownership on file with yours, and he wont read them.
I dont know your os, but you must change ownership on all files in your site tree to www-data:www-data and access rights to 775 directories and 644 for files.
And for the end, you named your site “mysite”, and put WP files in, and what is “public_html” doing in your directory or is “public_html” name of your site.

/home/mysite/public_html/wp-content/themes/mytheme/templates/single-page.php

All of my directory permissions appear to be correct. single-page.php had 644 file permissions when uploading.

/home/ (name of mounted HDD)
/mysite/ (i censored this, it’s not really “mysite”, and this is the name of the account)
/public_html/ (the public_html directory where all public files go)

Where is there your WP instalation, that is question? In what directory?

Root directory. mysite.com is my wordpress installation.

Also, you were right! I changed permissions of “media” folder to 755 and now it works perfectly :slight_smile:

Thank you!

4hr for access rights!

1 Like

Yes, but with your help, you changed the world. You should be proud of yourself.

Ye, I am so happy that is good that I live on seventh floor.

1 Like

Ha ha that’s why I rather remain on the ground floor - developers has the tendency to jump sometimes when issues like these drives us nuts;-)

I will rather choose not to activate the option in my case since 1) All my sites are multisite and 2) My server runs on NGINX.

Check de Folder Permission, set for execute and write public