Troubleshooting

How to add a class when the user is the admin

If you want to debug your online site, then you may want to add a class to your body if the user is admin. This way, by using appropriate css rules, you can make some parts of your site visible only to the administrator. To do so, add the code below to your functions.php:

add_filter('body_class','my_class_names');
function my_class_names($classes) {
    if (is_user_logged_in() && current_user_can('manage_options')) {
        $classes[] = 'admin-user';
    }
    return $classes;
}

And in your css, add the following:

.hide-to-visitors {
     display: none;
}

.admin-user {
     display: block;
}

Cookies do not work properly on my WordPress site

If you try to set cookies using the setcookie function and you fail, maybe you have a caching plugin on that messes with the cookies. Set the cookies using javascript instead and the problem will be solved!

Saving menu takes a long time and returns a black page without applying the changes

Possibly a PHP Error “Maximum execution time of 30 seconds exceeded”. Open you php error log, and check to see if this error exists. To fix it, increase the default or set maximum time for execution of a process on your server. Just open htaccess file and add this line to the top of the file:

php_value max_execution_time 60

See this article for more.

My WordPress site runs really slow on my wamp local server

Disable cgi_module. To do so right click on WAMP > Apache > Apache Modules> uncheck “cgi_module”.

You can also try this. Open http.conf of your wamp server and change this line:

ServerName 127.0.0.1:80

Open the wp-config.php and change this line

define('DB_HOST', '127.0.0.1');

You can also try the suggestions from this page too.

The WordPress emails are not sent on my wamp local server

You can see the solution here.

I cannot update my WordPress site using Wamp

If the error below appears when you try to update your WordPress site locally

Registration returning curl: (35) error:0D0C50A1:asn1 encoding routines:ASN1_item_verify:unknown message digest algorithm

then try to enable php_open_ssl in your wamp’s php extensions. That did the trick for me!

Enable comments on old posts

Open your site database using PHPMyadmin and use the following query:

UPDATE wp_posts SET comment_status = "open" ;

Post A Comment

Anti-Spam Quiz: