wp print_thumbnail function is not working

前端 未结 4 770
离开以前
离开以前 2021-01-16 19:41

wordprees print_thumbnail function is working correctly on testing server but it\'s not working on online server and giving wrong image path such as */var/www/vhosts

4条回答
  •  滥情空心
    2021-01-16 19:44

    Will's approach fixed the error for me, and was in fact the only answer that worked. This question is posted hundreds of times, so I figured I'd summarize the answer in short. I'll post the answer first and the research details after.

    • Login to WordPress
    • Goto Settings > Media
    • In "Uploading Files", modify the "Store uploads in this folder" to "http://www.yourdomain.com/wp-content/uploads2"
    • Notice the "2" added to the folder-name
    • Delete any entries in "Full URL path to files"
    • Save changes
    • Now your site should already show some images again
    • Do all this again but now change it back to "http://www.yourdomain.com/wp-content/uploads"
    • Save changes

    This finally worked for me.

    Gathering from other sources, this occurs mostly after moving a website from one location to another. Other fixes I did prior to this:

    • Within MySQL, replace the old URL in the GUID values in "wp_posts" to the new URL
    • Change "chmod" settings (it you never had any prior issues, don't)

    Many other answers to this issue included changing chmod to give access to the files, which didn't do anything but crash the website. Other solutions would've been to change the code entirely to use a different function. I figured it's not broken, just missing a setting. Turns out that was the fact.

    It worked for the domain http://www.in1week.nl, which runs on a modded DeepFocus template by ElegantThemes.com. The theme uses "timthumb" in the function "print_thumbnail()", which may have caused the issue. This reset the value needed to use the function.

提交回复
热议问题