My domain is tenspark.com. when a user signs up with this link https://tenspark.com/wholesaler/ . there is no issue. But if a user signs up with my subdomain link https://wholesaler.tenspark.com/ I have an issue with my admin-ajax.php file is not found.
This is due to the javascript function having hard coded domain name (https://tenspark.com/) instead of having a dynamic one. (see the screenshot below of view-source for https://whoesaler.tenspark.com/)
Solution:
Either change the url for admin-ajax.php to your subdomain one manually, or else make this code dynamic to adapt to any domain you're calling it in by using:
<?php echo admin_url('admin-ajax.php'); ?>
I hope it helps.
I am having very weird issue in my store. I get redirected to woocommerce setup wizard page when I try to open any page in admin panel.
I tried setting up woocommerce settings. I have gone through all the steps and at last I again get redurected to setup wizard.
when I deactivate woocommerce plugin it runs properly. But with woocommerce pplugin it redirects to woo setup wizard.
I found the tie breaking solution guys. It was like stuck on the same page.
I got a filter from woocommerce docs.
add_filter( 'woocommerce_prevent_automatic_wizard_redirect', 'wc_subscriber_auto_redirect', 20, 1 );
function wc_subscriber_auto_redirect( $boolean ) {
return true;
}
This stopped the redirection from admin panel to wc setup wizard.
There is few options why this might happen, but probalby Your browser do cache wp-admin panel url with WOO wizard redirection.
Frist try solution: Delete browser cache.
This is what I use to prevent redirection
add_filter( 'woocommerce_prevent_automatic_wizard_redirect', '__return_true' );
When I'm changing the password from front side profile change functionality using "Profile Builder" plugin. Manually i add the logout functionality like below :
Logout
Then it asking confirmation that you really wants to logged out.
I don't want that confirmation, because it redirects to wp-admin for confimation.
Any way to forcefully logged out from front in wordpress.
You can activate the plugin and add the following code to functions.php
add_action( 'wp_logout', 'auto_redirect_after_logout' );
function auto_redirect_after_logout(){
wp_redirect( home_url() );
exit();
}
Change your link code to
Logout
I hope you can help
I have a wordpress multisite with a custom login which takes users to the root wp-admin by default which gives this error for those who do not have the correct permission.
You attempted to access the "WordPress" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "WordPress" dashboard, please contact your network administrator.
I would like them to be redirected to the primary blog like this example.
http://wordpress.org/support/topic/automatic-redirection-to-child-site-from-main?replies=15
However, my custom plugin in my mu-plugins does not contain $current_user and none of the functions to get the current user work.
The other functions I have built work no problem, so I know there is nothing wrong with the file getting included.
I figured it out in the end.
I hope this helps someone
function check_if_user_needs_redirecting(){
$active_blog = get_active_blog_for_user(get_current_user_id());
$blogid = get_current_blog_id();
if ($blogid != $active_blog->blog_id){
header('Location: '.$active_blog->siteurl.'/wp-admin/');
exit;
}
}
add_action( 'init', 'check_if_user_needs_redirecting' );
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!