Wordpress site displays replacement character � in posts - wordpress

Launched a new WP site about 1 month ago, and there were no issues at the time. Now there are instances of this character (�) inserting itself into posts. Looks to be happening where an open tag begins. Some sort of character encoding problem? Only happening in posts, not pages, so possibly a database issue?

You haven't copied and pasted the content from another editor like Word, have you?
It's encoding causing the problem, where Wordpress doesn't recognise the character you're using. If you hand code it rather than using the visual editor you shouldn't see it, and the most likely cause is inheriting the character from a piece of software that you have previously edited in.

Step 1) Open the wp-config.php file in a text editor such as notepad (the wp-config.php file can be found on the directory where you installed WordPress).
Step 2) Find the following two lines and comment them out:
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
They should look like the following after you comment them out:
//define('DB_CHARSET', 'utf8');
//define('DB_COLLATE', '');
Step 3) Now upload the updated wp-config.php file to your webhost (overwriting the old one).

Related

How to change text in WooCommerce My Account Downloads area?

In the Downloads tab of the My Account area in WooCommerce, by default the text says "No downloads available yet". I need to change this text to something more specific.
I would rather not do this by copying plugin files to my child theme, but would prefer to do it with code snippet.
If anyone can help, it would be massively appreciated.
Many thanks for your time.
If you have access to ftp you can open the folder of Woocommerce plugin into a text editor.
You can find for the string and replace it by a more specific one directly into the code.
I think it's the cleanest way.
Let me know if it works.
You have different ways of doing this:
1- Copy wp-content/plugins/woocommerce/templates/myaccount/downloads.php to your theme folder inside /woocommerce folder and overwrite the part where the string is outputted -> recommended
2- Edit the woocommerce-[LANG_CODE]_[LANG_CODE].po file inside wp-content/languages/plugins but you would lose this if you update the plugin
3- If you have WPML installed you can do it via string-translation feature
4- Edit it via JS, not so clean but hey, it would work! :D

Symfony2 renders template with blank line at top

My template starts with <!DOCTYPE html> on the first line, but for some reason when I view source on the page that's rendered, it starts on line 2.
This isn't a big deal in HTML, but I'm trying to render some XML and I'm running into the same issue, except XML isn't forgiving like HTML and must start on the first line.
EDIT
Thank you for the comments! I am a fairly new developer and was not aware of the BOM. That being said, I use PhpStorm, and you can just right click on a folder, then click 'Remove BOM', which I have done.
After doing that I ran this terminal command I found someone post grep -rl $'\xEF\xBB\xBF' that outputs files in the directory that have the BOM character. There were a few files listed, and I've fixed them all except /vendor/doctrine/orm/lib/Doctrine/ORM/Query/TreeWalkerAdapter.php. I've tried removing the BOM with PhpStorm, and haven't had any luck, so I opened the file with VIM and ran set nobomb like I found here: How do I remove  from the beginning of a file?, but it still comes out in the listing of the grep command above.
I faced the same issue, but because I closed my PHP file with "?>" and added some blank lines after. After removing the "?>", problem has been solved.
In this case nothing related to BOM directly (I was in UTF-8).
If this can help other people who find this post with the same issue than me.
See post : php: empty line from nowhere

I cannot log in my wordpress website

When I open my website link ,I found errors.The error is:
"Cannot modify header information - headers already sent by (output started at ...../wp-includes/pomo/entry.php:2) in /...../wp-includes/pomo/pomo.php(1) : eval()'d code on line 1".
And I cannot log in my website admin that shows plugabble.php errors.
How can I do that?
You need to troubleshoot whats going on...
Check plugin compatibility issues, deactivate plugind and see if it works
Another problem might be that you have gotten some text or whitespace [spaces or newline] before the opening PHP tag or after the closing PHP tag in your theme's functions.php file. There can't be a single character before or after those tags, check that...
Remove white spaces from other files, on wp-congig.php maybe...
Do your research on wordpress forums, the below link might help
https://wordpress.org/support/topic/cannot-modify-header-information-headers-already-sent-4
Its white space error or space in < ? ? > <? php etc.
so check again. also as per your notice check includes/pomo/entry.php:2 this file and see line no 2.
if there is extra space etc then remove it.
ALso if it will not solve then open function.php file of theme and remove space in bottom of the page.
or last step is remove space from wp-config file.

When editing Drupal's .module files in Dreamweaver or Notepad++ how can I make the PHP code appear in different colors?

A simple usability question. So I got a Dreamweaver 8 (I'm kinda used to it by now) and I've just downloaded Notepad++. (Before that I used simple Notepad) What I like about these editors is that the PHP code appears in different colors. So if the colors are not right then you immediately know that you're doing something wrong.
But this works for only the files that end with .php
But Drupal's files end with .module and .inc etc... and it's often a nightmare to look for some comma or a single-quote that's messing up your code. So how can I make Dreamweaver or Notepad++ to show me the code in .module and .inc files in colors?
in notepad++:
Settings > Style Configurator...
Find PHP in the Language listing select it then add your desired extensions in the "User Ext :" field
leave the dot off and separate them with a space. you'll need to reopen the document after you save the change.
I created a Drupal 'user language' for Notepad++ so you can get autocomplete and sytax highlighting:
Here is how to install in the last post here:
https://drupal.org/node/326803
Enable clickable links : Settings**->Preferences->Misc->**Enable clickable link
Enable PHP Syntax Highlighting for .module files, .inc files and .install files by clicking Settings**->Style Configurator-> Click on the php extension in the left sidebar and copy and paste "module inc install" into the user ext box without the quotes of course and Save and close. Voila!

Wordpress - Images not showing up in the Media Library

I have a huge problem with my Wordpress. My uploaded images don't list in the Media Library.
It is weird tho, it says I have 75 images, but display none. Take a look yourself.
Even weirder, if I go into gallery (the images you uploaded in the page itself), the images list just fine.
I already tried deactivating all my plugins, didn't work. Cache can be easily put out of the question, because it happened on at least 4 different computers, with Macs, PCs, and navigating with Safari, Firefox and Chrome.
Another interesting fact is that if I upload the image directly trough the computer (with the "From Computer" tab), everything goes fine. Another website on the same server works just fine too. And just to add to the complexity, when I go to the media page in the Wordpress Admin, all images show up just fine.
Oh, and before I forget... applying any filters, or doing a research in the media will always come up with the same problem.
So there... that's where I'm at.
I had a same problem just now, with missing media library images for my blog. The images appeared to be right there in the media library and were definitely on the actual web server (checked via FTP).
As Allen Z advised I did "check Settings → Media and make sure that Uploading Files folder is set to wp-content/uploads"
Mine were set to the default blank. I altered this to an absolute path http://www.example.com/wp-content/uploads
THIS DIDNT SOLVE THE PROBLEM when I refreshed the site in browser. However, I immediately changed the path back to blank (the default setting again) and everything came back! Woop
Everyone having this problem might want to try this before getting into the more technical fixes!
it was your permalinks... you must have changed to labeled-name... switch back to default.
that worked for me.
Check Screen Options (dropdown tab in the upper right hand corner of the page), and make sure there are sane settings for what to show on screen. All the column settings should be checked, and there should be a positive number of media items being shown on screen.
If that is ok, then check Settings → Media and make sure that Uploading Files folder is set to wp-content/uploads.
I believe these are the only settings that can be changed from the administrative screens.
Here's something a guy on Wordpress forum showed us. Add the following to your functions.php file. (remember to create a backup of your functions.php first)
add_filter( 'wp_image_editors', 'change_graphic_lib' );
function change_graphic_lib($array) {
return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
}
...it was that simple.
Well, Seems like there was a bug when creating custom post types in the function.php file of the theme... which bugged that.
I had this problem with wordpress 3.8.1 and it turned out that my functions.php wasn't saved as utf-8. Re-saved it and it
I faced same issue on my wordpress site. After the lot of debugging i fixed my problem step by step like this.
First add given below code your db-config.php
define('SCRIPT_DEBUG', TRUE);
define('WP_DEBUG', TRUE);
define( 'WP_DEBUG_LOG', true );
Then goto /wp-includes/js/wp-util.js files and find the code $.ajax(
options ) on line number 100 insert given below code into your file
deferred.jqXHR = $.ajax( options ).done( function( response ) {
try {
response = JSON.parse(response);
} catch (Exception) {
response = response;
}
Please check your may be resolved.
if you Removed constant from db-config.php
define('SCRIPT_DEBUG', TRUE);
define('WP_DEBUG', TRUE);
define( 'WP_DEBUG_LOG', true );
Then compress your /wp-includes/js/wp-util.js file code and put your compressed code into /wp-includes/js/wp-util.min.js
*change your own risk if your update your wordpress version your changed may be lost.
Did you ever change the directory of your Wordpress install?
I had a problem with not finding my uploaded images after changing the Wordpress location on my server. In Wordpress, I went to Dashboard-> Settings -> Media and changed the uploads folder in the "Store uploads in this folder" field.
Considering the files were not uploaded via media uploader, they are present in the server but there's no reference to them in your database (in a little more detail).
In order to fix it, install the Media Sync plugin. Once it's active, under Media > Media Sync > Scan Files and select the files you want to import by click the checkbox next to them. Make sure also you untick the selectbox Dry Run (test without making database changes).
Then, when the time comes for you to be ready, just click "Import Selected" and you should see something like this
Once it is finished, you can visit Media > Library and you'll see all your imported files there.
How did you upload those images; via FTP or through WP uploader? You have to upload images THROUGH WP uploader in order to show them in the image library.
Ubuntu stores uploads in /var/lib/wordpress/wp-content/uploads . So what you need is to have this directory within your wordpress installation. Something like:
sudo ln -s /var/lib/wordpress/wp-content/uploads /var/www/www.mysite.com/wp-uploads
(replace mysite.com with your domain, the file should exist) should do the trick.
(Note that I've not tested this with multiple wordpress installations on one server.)
Further note that to make upload work at all (but this wasn't the question), you need to change Settings / Media / Store uploads in this folder to
wp-content/uploads
(no leading slash).
check .htaccess file in root of wordpress, maybe there is a rule for /uploads directory.
if so, remove it. but be careful and check which plugin did it, so disable the plugin, first.

Resources