Wordpress admin bar not showing on frontend - wordpress

I've tried everything I have found but nothing helps me.
I've put
<?php wp_head(); ?>
in header.php
and
<?php wp_footer(); ?>
I even tried:
Disable all plugins
Default WP theme
and etc.

Some custom wordpress theme doesn't show the admin bar into the theme page same with the wp_head() and the wp_footer() wrote on the templates files.
To resolve that problem just add the following code into your function.php or into your own plugin:
function admin_bar(){
if(is_user_logged_in()){
add_filter( 'show_admin_bar', '__return_true' , 1000 );
}
}
add_action('init', 'admin_bar' );
Hope that help...

If you had the bar showing previously, you might try this super-easy fix (worked for me):
Go to your profile in WP Admin
Check to see if "Show Toolbar when viewing site" is checked
If not, select this and save … that should fix it
If the option IS checked, deselect it and save. Then, select it again and save.
Now have another look at the frontend. I did this and it fixed whatever the issue was without messing with any of the files.

I have managed to make it appear again by adding
<?php wp_footer(); ?>
in "header.php" after </header> tag.
One important thing is to clear cache (check if you have cache plugin for Wordpress installed like WP Super Cache or LiteSpeed Cache..) and then CTRL + F5 to refresh page.

Try disable your plug-in cache or disable for logged-in users. I had similar problem using WP Fastest Cache. Just disabled chache for logged-in users and it's working.

If nothing helped you, try to delete all cookies. It works.

Solution is to put
show_admin_bar(true); on top of your functions.php file.
EDIT fix:
Put like this to show only when user is logged in:
if (is_user_logged_in()) {
show_admin_bar(true);
}

I had this problem on our production site, but it was not occurring on local or staging sites. Turns out that the WordPress Address was incorrectly set with www whereas the site was always accessed without the www.
The fix:
Go to settings > General
Ensure that WordPress Address and Site Address both match your site URL exactly
Posting in case anyone else has same problem.

Shortly: Most probably you have not logged in!
Long answer:
This problem happens to the new WordPress learners who try to create a custom theme. They put the wp_footer() and wp_head() functions and refresh and still do not see the admin bar. And it is because they have forgot to log in to /wp-admin/

In my case it was missing php extensions curl and intl
but above all php-curl

I am using WP Super Cache, and what worked for me was disabling this option in
WP Super Cache Settings / Advanced / Cache Restrictions:
Make known users anonymous so they’re served supercached static files.

Just go to the wp-config.php file in your root directory, set
define('WP_DEBUG', false);
to
define('WP_DEBUG', true);
and go to the webpage where admin bar is not loading. There has to be some error in you php code.
The problem is that admin bar loads in wp_footer hook or something, and if you have an error in you php code the page just stops loading and that's why admin bar is not showing AND THAT'S WHY ADDING WP_FOOTER() TO "header.php" WORKS FINE.
Better check errors, because you probably will get another funny things on your website later.
Good luck!

Related

Notice: register_rest_route was called incorrectly

In my Wordpress site, this issue appears when adding or editing posts.
Notice: register_rest_route was called incorrectly. REST API routes must be registered on the rest_api_init action. Please see Debugging in WordPress for more information. (This message was added in version 5.1.0.) in /project/wp/wp-includes/functions.php on line 5167
Note: I didn't make any WP update or any plugin update on the site.
Any idea to fix this issue? Thank you.
In WordPress 5.5, a change was made to how REST routes are registered and now required a permission_callback.
The reason you may see it the notice on one site and not all is that notices only appear when WordPress is run in DEBUG mode, confirm by checking the value of wp-config.php for
define( 'WP_DEBUG', true );
If the site showing the notices should not be in debug mode, simply change the value of WP_DEBUG to false.
A plugin or your theme are creating a REST-Api route in a wrong hook.
This is correctly done by using add_action('rest_api_init', 'function_to_create_end_endpoint');
function_to_create_endpoint contains the function register_rest_route().
In your case it's something else ('init' or 'plugins_loaded' instead of 'rest_api_init')
Some solutions:
Update all Plugins/your Theme to a current Version
If this doesn't help you can: Deactivate Plugins one by one, to see which one causes the issue, than maybe replace it or check if is abandoned
Search for "register_rest_route" in your wp-content folder and find the plugin that calls it in a hook something other than "rest_api_init".
Lastly Notices only show up when you turn on full debugging in your wp-config, this isn't meant for sites running in production. You could turn it off.

wordpress wp-admin login doesnt work after wp-config edit

I made a mistake by erroneously changing the site URL in general settings in Wordpress.
My website pages would load but I got a redirect loop back when trying to login on the wp-admin page.
To fix this I accessed my wp-config.php via SSH and added the following:
define('WP_HOME','http://swsportpsychology.co.uk');
define('WP_SITEURL','http://swsportpsychology.co.uk');
Now my website still loads as before but the wp-admin page will not load at all, so I cant login and it says cant access server.
How should I fix this? Any ideas?
Update
I have also added this to my themes functions.php:
update_option('siteurl','http://swsportpsychology.co.uk');
update_option('home','http://swsportpsychology.co.uk');
But still no fix.
Try adding this to your functions.php in your theme:
update_option('siteurl','http://swsportpsychology.co.uk');
update_option('home','http://swsportpsychology.co.uk');

Redux Framework Warning in wordpress Theme and Theme customization options not working

Redux Framework Warning ace-editor-js CDN unavailable. Some controls may not render properly. Please wait a few minutes, then try refreshing the page. Unable to load some remotely hosted scripts This error accoured and Theme customization options not working and not display when click on options it will display blank.
I am begginer in wordpress, Anyone can give the suggestions why this error occured.
When I used Redux Framework Plugins Then All options are working.
I got solution from https://wordpress.org/support/topic/redux-framework-warning-cdn-unavailable
The above solution has nothing useful for me.
My solution was to disable the code snippet in my wp-config to restrict external url requests
define( 'WP_HTTP_BLOCK_EXTERNAL', true );
if ( WP_HTTP_BLOCK_EXTERNAL ) {
define( 'WP_ACCESSIBLE_HOSTS', '*.wordpress.org,*.example.com' );
}
Alternatively, I could add the CDN domain used by redux into the define...
For me - it resolved my problem.
My next idea would be to check the htaccess for Order Deny,Allow....

Wordpress dreaded white screen while creating or updating a post

I created a wordpress theme and after uploading and activating the scheme to the server everything looks all right... but when I try to use the admin section of wordpress then I am having a problem with a 'white screen' or when creating new posts and when trying to log out... when i try to update a post or create a new page it just stays on post.php and the page is left blank.. Please suggest what should i do?
I have the same theme running on my local xampp server but it working ok.
You should enbale Debug in your wp-config file , there must be an error in the code which is causing this issue.
define('WP_DEBUG', true);
I had a similar problem where anytime I added or updated a post I got the white screen. The problem for me was also in the functions.php file. Not sure what it was specifically, but I went back and got an older version of the file. Problem solved.

Wordpress Theme Compatibility Issue

I'm developing a WP theme for a client and have run into some trouble.
When my theme is activated:
I edit post or page (or several other areas), click UPDATE, PUBLISH, etc - and I get a blank white page.
When I go back, the post has been updated - so the system is working, it just isn't redirecting me back to the edit page.
Everything works fine when the default template is activated.
Thanks!!!
To trace the error set the WP_DEBUG as true
Refer : http://www.wprecipes.com/how-to-easily-enabledisable-debug-mode-in-wordpress
Change WP_DEBUG to true in wp-config.php file located in the WordPress root folder, and then you will be able to see the errors that are coming up. Fixing those errors will resolve your problem.

Resources