wp print_thumbnail function is not working - wordpress

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/vinehospitality.co.za/httpdocs//wp-content/uploads/2011/12/slide-10-108048_56x56.jpg*.
So kindly help me to get proper url.
Link of website: http://vinehospitality.co.za.plesk15.wadns.net
Same problem is found in hosted on this server.
Regards
Neeraj

Not only did it work, it was SO MUCH easier for me.
Simply, delete whatever custom link you have in Media Settings. If you don't have one just put anything there..
Then save, again, put back the original path you have before, save.
Worked!
Somehow it seems wordpress reads the wrong values when you move servers and you don't resave media settings.

POSSIBLE FIX 2
Look, I've seen this problem on other threads and on other websites and no one gave information that helped most of the people with this issue, so since I somehow got my broken site to work, perhaps it will help the others who did not get their problem solved.
Here's a little background... I needed to move a wordpress site located on a dev server to the live server. They were different domain names of course. First of all, I should have followed Moving Wordpress instructions and updated the site url before I exported the database, but... I didn't because I'm obviously too cool for instructions.
In order to transfer the site, I zipped up the files and transferred them to the new server and unzipped them. Then I edited wp-config and pointed it to the new database.
I used phpmyadmin to export the old database and I imported it to the new database.
Then I ran a query on the wp_posts table to do a string replace on the guid field and replace all instances of the old domain name with the new domain name.
Then I checked in wp_options and changed 2 records to replace the old domain name with the new one. I think they were something like siteurl and home.
Everything seemed to be working fine except the theme was mangling the img urls, prefixing them with the absolute filepath.
I figured I must have missed some records in the database that give the print_thumbnail function whatever information it needs to output the right url for the img's src attribute.
I thought if I could change a setting somewhere and change it back, maybe wordpress would automatically fix the issue for me, and I was lucky.
I played around with several settings and what finally worked was:
I went to Media Settings and I unchecked Organize my uploads into month- and year-based folders -- I don't know if this had much to do with the fix.
I also changed the Store uploads in this folder to something like wp-content/uploads2. I never created that folder, but I just wanted to get it to overwrite whatever was controlling that value.
I checked the site again and there was a change to the html source... now, it didn't even give the img tags a src value... it was just like <img src title="blah blah" />, so I figured I was on the right track.
So then I went back and changed Store uploads in this folder setting and left it blank as it was originally.
After I did that, the img src values were correct.
Hope this saves someone some time.
Also, I should note, I played around with altering the file permissions for the wp-content directory. I wish I hadn't. I get the gist of file permissions, but I tend to try not to fool with them if I don't have to. Using Filezilla is a pain to change the file permissions because it takes forever. Unfortunately, as most clients, this one had a prior affiliation with their web host and refused to take my advice and host their site on a VPS that would be cheaper and allow me to use SSH and get work done much easier. I wonder if there's a fast way to chmod multiple files without ssh, I should look into that.
Cheers,
Will

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.

I faced the same problem and had to look around a lot in search of an answer. After my host moved servers, thumbnails weren't appearing on the home page and category pages. Looking up the source showed me that the path generated for the thumbnails was incorrect. Instead of http://.. in the image paths, I was seeing absolute file paths in the server, such as /home/..
Couple of solutions that seemed to have worked for others did not work for me.
What did not work:
Changing permissions of wp-content/uploads and all the directories under it.
Changing media settings and again reverting back to original settings.
Using 'the_post_thumbnail' instead of 'print_thumbnail' function helped the thumbnails come back, but I am no programmer and could not figure out how to make the_post_thumbnail function work exactly as it was working with print_thumbnail
What worked:
In my many searches, I read someone saying that the problem was fixed by correcting the path for 'et_images_temp_folder' in the database. I ignored this for a while since I did not understand what it meant. Later, I searched wp_options table and found that it had the following entry.
option_name: et_images_temp_folder
option_value: /home/painteds/public_html/darter/wp-content/uploads/et_temp
When the servers were moved my home dir was changed from /home to /home3 Perhaps print_thumbnail was searching for /home folder, and was malfunctioning when it could not find it. Updating the database with the new value fixed the problem for me.

Related

WordPress Images not loading after migration

I'm facing a problem the last couple of days and I can't figure it out. We changed the hosting company and move our website (same domain name) to another hosting provider. After migration, images not loading, and I can see them broken in WordPress's Media Library.
I tried to change the permissions in the upload folder but that didn't worked. SSL is also working as expected. I disabled all the plugins and even changed the theme, but the problem still persists. I re-uploaded all the backup files again to make sure that I wasn't missing something, but the problem haven't been solved.
I also have the support team from the hosting provider that works on the website, but there's been 2 days now and they can't find a way to solve the issue.
In the browser's Search Console I do see the following errors: https://ibb.co/y0KCmHY
I've also checked the DNS settings in CloudFlare to make sure that I have setup everything correctly.
Any help will be much appreciated!
I am no wordpress expert but I think I would first check whether image files in your backup files are not damaged/corrupted.
I would check both your backup files and image files in your new hosting server
(download image files from your new hosting server via FTP)
Sorry I couldn't help you much except where to look at first which you might already know.
From the image that you've provided, what I can tell the status is 404 like you know which means your image is not found. Something wrong with all your image URL. You need to make sure the URL is correct for each image you have.

Wordpress edit post/page screen is messed up

I've transferred my wordpress website from a shared hosting to a linux VPS.
Everything is working fine instead of one thing. I'm getting realy weird pages for editing posts/pages.
I'm not sure how to name it and can't find anything on google about it, so I hope someone here can send me in the right direction.
Screenshot
At a quick glance, looks like a browser caching issue. Try the following:
Clear browser cache/cookies etc. and restart the browser/PC
Check with a different browser
Depending on how you migrated (transferred) the site, it is possible that all files did not get transferred fully and/or the database did not get imported fully. If 1. and 2. above fail, delete everything from the VPS and try again.
I'm sure when you check the network tab or console in inspect element on chrome, you will receive a lot of 404 errors because it is not able to load the required files for some reason.
What you can try is to add define('CONCATENATE_SCRIPTS', false) into your wp-config.php file. What this does is load all the javascript files individually, instead of one concatenated file.
Question: Are you using the same domain on your VPS? Or are you accessing the site on your VPS through a different domain? If so, you might want to update your database to correspond with the domain you're testing with now. Because this can cause strange behavior as well.

Wordpress doesn't update file on live site?

Long story short: I f**** up a live website and now it won't revert my changes despite rewriting them manually on the files laying on the ftp.
In the wordpress editor I can access the files laying on the site. I changed the color on an element to #fff but forgot the ';' symbol. Now the typo persists and I can do nothing to change it. I've tried changing it both in the wordpress editor and on the file on the ftp. Changing another file in the same directory is no problem. No it is not a cache problem.
If anybody know a way to troubleshoot this I would appreciate it a lot. This website is as I said live and my customers.
If the site is using a caching plugin then you may need to clear the cache before the changes are visible. The fact that you say that it took two hours to update points to this as the issue. Make the change then clear the cache.
Here are some examples: http://www.inmotionhosting.com/support/edu/wordpress/recommended-wordpress-plugins/clearing-cache-in-wordpress

Two Wordpress Installations on the Exact Same Database?

I'm in the progress of setting up a development and live development environment for some basic projects I'm working on. Ideally I want git to push changes from the development server to the live site. However I want each version to use the exact same database so the posts and content are identical at all times.
Obviously the Site URL is set to only the live site so the development site's links don't work. If I overrode the site url in the wp-config.php file of each and used .gitignore to ignore both wp-config.php files would this be enough for this to work or is there something else I'm missing?
I'm posting in the hope somebody has tried it before me and that might have any answers to problems I encounter now or in the future.
Thanks in advance, Ollie
Make sure you add the .gitignore entry before changing and committing the wp-config.php.
Once you update wp-config.php, it's going to go through and update URLs in the database. Since WordPress is stateless - to say there is no session management, there is no way of tracking if a database has been swapped.
Lastly, WordPress uses a MySQL database, which wouldn't be versioned unless you went through a lot of work to do so. Aside from wp-config.php, there aren't any other stored references of what the site's URLs should be.

Migrating wordpress 3.0.1 from one server to another

Here's what I wanted to dot, what I've done, and... the (poor) result:
I wanted to: migrate my personal Website from one server to another one, and only change the IP on my DNS. So:
I changed the IP on my DNS. Ok. Everything's fine (it's been 7 days now)
I dump my Wordpress 3.0.1 database from server A
I copied recursively the full directory of my personal Website to the server B
on server B: I've created my utf8 wordpress database then re-injected the SQL dump (from A)
I've created the good user with the right permissions on the database B
And now:
Everything works fine... Well Err... only the main page! See http://olivierpons.fr/ then click on a topic.
I can't even log in! Do you know where I should look or what I am missing?
Thanks a lot!
Olivier
Check if you included the .htaccess file. It's easy to forget those "hidden" files
Has your domain name changed? Your articles seem to link to oliverpons.com, rather than oliverpons.fr. If you've changed the domain name, you'll probably want to change the "siteurl" and "home" values in the wp_options table. See this Codex article for more info. Also, as windyjonas says, check your .htaccess.
Bear in mind that this isn't really a programming-related question; you may be better off asking in other places.
Okay I still don't know where the problem was, but here's what I did:
I exported all the articles from my
old webserver A into a file XML_A
I created manually a new database on B
I launched Wordpress on B
I created all what's needed on B,
I imported all from the file XML_A
It works now but I'm pretty convinced this is not the right way to do this...
And I finally found the right answer an the right place (in case this might help someone):
http://codex.wordpress.org/Moving_WordPress
Try this method as well if it works for you.
http://www.sayopenweb.com/migrating-wordpress-from-one-domain-to-another-domain/
especially if your URL or domain is changed.
I had the same issue and figured a custom way of migrating it. follow the link.

Resources