Either “name” or “item.name” should be specified (in “itemListElement”) error

There are few different reasons to get this error but here is my case: It involved WordPress and Yoast SEO plugin. I suddenly received this error from google search console, it said:

“New Breadcrumbs structured data issues detected”

Top critical issues*
Either “name” or “item.name” should be specified (in “itemListElement”)

*Critical issues prevent your page or feature from appearing in Search results.

Now that sounds serious, right? Not have your site or page appear in Search results? Ouch!

One of the solutions for this is to go to WordPress settings -> Reading and then select a page for your homepage. This is where Yoast SEO will read the missing data.

But in my case I could not do this because there is no homepage, I use “Your latest posts” as a default “homepage”. So somehow this confused Yoaast SEO plugin (can also be other plugins). Luckily there was an easy fix within Yoast.

In WP admin select Yoast SEO -> Search Appearance then breadcrumbs tab and then find the Anchor text for the Homepage field. Fill it with anything you want, I used “Home”.

Save it and if needed wipe the site cache and the problem should be solved.

Keep in mind that this error can appear on any page that has this name tag empty. This solution is just for HOMEPAGE problem, because that is what Google search console told me: root URL had this problem. If you have the problem with specific subpages or posts then this will probably not solve your problem.

CSS files not refreshing on – wordpress / siteground

If you have siteground hosting (could be the same for other hosts) and maybe WordPress site and you just edited a style.css file, reloaded your page but you cant see the changes (they appear after some time) then it is probably a Super Cacher issue.

Go to your siteground cpanel, find SuperCacher under Site Improvement Tools and click it.

Then find your domain, click Flush Cache then turn it Off.

Here is some more info:
The Static Cache option caches all static content on your account that includes images, CSS files, javascript, flash, and more. Once enabled, all requests of future visitors to your pages will be answered from the cached content and not directly from the server. If you just made changes to your website and want to see them live immediately, you could use the flush button to purge the cache on your account and not wait for the automatic server flush that happens over periods of a few hours.

So one approach you could use is this : turn off cache while you are editing the files (through FTP, not in wordpress admin) site. Once you are done just turn it on again.

WordPress Custom Fields missing in admin (post or page)

This is a very specific problem so it might only work for some. After I updated WordPress and all plugins on an old site that used WordPress Custom Fields to enter some data, the Custom Fields in admin disappeared. I could add a new post but Custom Fields were nowhere to be sen, not even in the screen options.

Long story short, after doing some searching on the net, I found out it was ACF (Advanced Custom Fields) fault. In new version of the plugin they disable WordPress Custom Fields because they think you are using ACF anyway so no need for both. Not sure I agree but here is 2 ways you can try to solve it:

  1. If you activated ACF but are not using the plugin, just disable it.  WordPress Custom Fields should come back.
  2. If you want to keep both then add this code to your theme’s function.php file (the best is the child theme, if you have one)
    add_filter('acf/settings/remove_wp_meta_box', '__return_false');

WordPress Custom Fields should reappear now.

Fix “Failed to send your message. Please try later or contact administrator by other way.”

I am using Contact Form 7 on one of WP sites and after update (not sure which one) I started getting this error after user submitted the form:

‘Failed to send your message. Please try later or contact administrator by other way.’

As always, lots of way to complicated solutions on the net when, in my case, the solution was simple.

This is what I had before (CF7 admin):
wrong mail contact form 7

And this is the one that works (I just replaced data in the FROM field):
correct mail form 7

of course you need to replace domain.com with your domain.

I do not know why did it worked before and why it stopped working but this is how I solved it. Of course you cant just hit reply now because your email is REPLY email. To solve this you can try this :

Contact Form 7 has a field called “Additional headers:”. Enter (literally) Reply-To: [your-email] and save.

Get WordPress Post ID Outside the Loop

It is easy to get a post ID in WordPress. To echo it on screen we write:

 <?php the_ID(); ?>

To store the ID into variable we use something like this :

 $id = get_the_ID();

There is one caveat though: if you read the description on WordPress codex it says this in both cases: This tag must be within The Loop.

So if you ever wanted to retrieve or display the WordPress post ID in footer or header or outside of The Loop you might end up being disappointed because the ID returned is not the correct one (usually we always get the same id, most probably the last one?)

Now I am not going to go into technical details or why is that so here is the solution that worked for me. You

$post = $wp_query->post;
echo $post->ID;

There are some other ways with global variables and some other but it seem it doesn’t work for everyone. This one worked on the first try. Let me know in comments if it doesn’t work for you.

Turn On Error Reporting on WordPress Blank / White Screen of Death

There is nothing worse than getting blank screen when developing for WordPres – also ‘officially’ known as The White Screen of Death – because you have no idea what went wrong. No errors, nothing useful, just blank screen. It’s even worse when it just appears out of nowhere. This happened to me few times in the past and then just recently. Woke up in the morning and the entire site (not this one) displayed just blank white page.

First thing you should do is rename the plugins folder and see if it works. If yes then the problem is in one of the plugins so if your admin works start disabling plugins one by one. If admin doesn’t work then try renaming plugin folders via FTP. If this doesn’t help then rename the themes folder and see if the problem was caused by one of your theme.

This didn’t help in my case. So I went to WordPress site (link below) and insert the code they recommended! It STILL didn’t work and there were no errors displayed! So finally I modified the code a little and finally the error appeared! I don’k know why are they posting a solution that doesn’t display the errors.

Here is the code that started showing errors and I finally able to fix it. Still the mistery remains why did the blank screen start appearing when it was working just fine yesterday when I went to bed. Ah, the ‘joys’ of developing.

Open the wp-config.php file in the root directory of your worpress and insert this just above the /* That's all, stop editing! Happy blogging. */ comment. Refresh the WordPress and hopefully you will see PHP error telling you what went wrong.

// Enable WP_DEBUG mode
define('WP_DEBUG', true);

// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);

// Enable display of errors and warnings 
define('WP_DEBUG_DISPLAY', true);
error_reporting(E_ALL);
@ini_set("display_errors", 1);

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define('SCRIPT_DEBUG', true);

After you fix the error don’t forget to remove or at least comment the added code.

In case it didn’t work, here are some more steps to try to fix it:

Common WordPress Errors and Debugging in WordPress

Redirect all requests for the domain root to a specific page

This is for WordPress but can be used in any site because it uses .htaccess.

I needed to redirect all visitors that visit the root URL (for example elcoderino.com) to specific subpage (eg elcoderino.com/subpage). WordPress allows you to create a static front page or select a custom page that will replace default front page content but in my case it just didn’t work. Maybe it was combination of Advanced Custom Fields or custom post types but it just kept messing up the front page.

So the solution is to add this to your .htaccess file:

RewriteEngine On
RewriteRule ^$ /subpage/ [R=301,L]  

if your .htaccess file already contains RewriteEngine On then simply just add RewriteRule ^$ /subpage/ [R=301,L] below it.

Fix “Not Found” on WordPress & Wamp When Using Permalinks

I used to use Xampp but I decided to try Wamp for my new WordPress project. After installing WordPress on local machine and chaning Permalinks to Post Name in admin I suddenly started getting these errors:

Not Found
The requested URL was not found on this server.

Don’t you just love it when such errors appear? I forgot how I solved this in the past projects but remembered it has something to do with mod_rewrite and .htaccess. After Googling and trying out few solutions nothing worked until I realized that with Wamp you can enable mod_rewrite via WAMPSERVER Control Panel (you will find it in your tray).

So just click on WAMPSERVER icon, then Apache then Apache Modules and then scroll down to rewrite_module and enable it. Restart Apache (or restart all services) and your permalinks will work.

Enable qTranslate for WordPress 4

Seems like qTranslate is not really updated anymore or at least it is updated very slowly. So when I updated WordPress to new version I got this message and qTranslate editor in admin was disabled.

The qTranslate Editor has disabled itself because it hasn’t been tested with your WordPress version yet. This is done to prevent WordPress from malfunctioning. You can reenable it by clicking here (may cause data loss! Use at own risk!). To remove this message permanently, please update qTranslate to the corresponding version.

I guess the easiest way is to just click on the link and it will probably enable itself. I googled it and it seems some people might have problems with that. So the solution that worked for most people is this:

First, open wp-content/plugins/qtranslate/qtranslate.php file and change line 90 from

define('QT_SUPPORTED_WP_VERSION', '3.7.1');

to

define('QT_SUPPORTED_WP_VERSION', '4.0');

just save it and that’s it.

Of course if WordPress is updated to new version qTranslate will disable itself again. What you can do is enable it for all version by dynamically inserting current WordPress version, like this

define('QT_SUPPORTED_WP_VERSION', get_bloginfo('version'));

qTranslate will now work for all (future) versions of WordPress.

Hint: You can find out your WordPress version on the bottom right in the admin or by opening a file /wp-includes/version.php and checking the $wp_version variable on the top.

Note: Do this on your own risk. It seems to work for most people but beware you might loose your data if something goes wrong. The safest way is to wait for author of qTranslate to update it but it seems this is not happening.

How to Fix – WordPress: Briefly unavailable for scheduled maintenance. Check back in a minute

WordPress update stuck in maintenance mode

In some cases the message “Briefly unavailable for scheduled maintenance. Check back in a minute” doesn’t disappear after you update your WordPress, despite the update being successful. Even worse – you are locked out of admin because both admin and your site display this message.

How to fix the WordPress maintenance mode problem? The solution is simple. Use your FTP program to connect to your server and delete the .maintenance file from your server (it is in the WordPress root directory, same as .htaccess). In most cases this will fix it. If the update did not finish then loginto admin and try to reinstall WordPress updates.