Wordpress admin notice always showing same message - php

On the admin dashboard, I display admin notice to display the result of changes. I have production site and staging site. On the staging site, it works well. If I made changes, it's displaying the notice of appropriate message. But on production, it's same code as staging site. When I made changes, it's displaying the "cached" notice but not the appropriate message.
Here is my approach to solve this.
$flash_messages = maybe_unserialize(get_option('wp_flash_messages', array()));
print_r(flash_messages); exit;
This displays the 'cached' message.
delete_option('wp_flash_messages');
$flash_messages = maybe_unserialize(get_option('wp_flash_messages', array()));
print_r($flash_messages); exit;
I added delete_option() before get the message. But it returns the 'cached' message again.
EDIT : I cleared server cache as well.
It's really annoyed.
Can anyone help me?

Finally I found the issue is because of get_option() function is cached.
https://developer.wordpress.org/reference/functions/get_option/#source
Here you can see the function get cached data first and if not, look through db and get option.
ANSWER
wp_cache_flush();
This resolved the problem.

1) You can delete cacle from WPEngine is a managed WordPress hosting provider. They run their own caching solution, so their customers don’t need to install a caching plugin.
If you are unable to notice changes take effect immediately, then you can easily clear WPEngine cache from your WordPress admin area.
2) You can also delete cache by using wp super cache plugin

Related

Craft cms - page not found

After setting up a template file article.html in craft/templates folder, and creating the section article with the uri article and setting the entry template as article in the admin on trying to see the live preview of the page when I go to it in the entries list I get a craft page with the error:
Page not found
I thought it might have something with cache maybe, so I cleared that, but I still got the same error. Why I am getting this error, and how can I fix that?
It might be a database not updating issue, have you tried making a backup of your current database and start with a fresh one?
If not, then check .htaccess and your routes.
First crate a 404.twig file.
Open general.php file "config/general.php" and change the devMode to false.

Wordpress - admin_init hook being called multiple times?

I've got a problem on my Wordpress site which I tracked down to admin_init being called twice.
I tried deactivating all the plugins and the problem goes away. I then reinstated each plugin and found which one is causing the problem.
My question is, how can I find the cause of the extra admin_init call ?
The plugin is bespoke to the site so I can't simply replace with a different plugin and it's one (blushes profusely) that I have muddled together myself.
Here's what I've got so far after doing some research on the subject...
I've added
remove_filter("wp_head", "adjacent_posts_rel_link_wp_head",10);
to the functions.php file (although this may only stop the "init" hook being called twice and not the "admin_init")?
I set up a function that sends me an email every time admin_init is called. Whilst generating the email I added the following code to it:
$backtrace = print_r(debug_backtrace(), true);
and then added $backtrace to the email text.
The first email I get has the full backtrace showing all the functions that have led up to the admin_init call originating from "admin-ajax.php". The second admin_init call email doesn't have any backtrace info at all ?
I also read that multiple calls to the init (and presumably admin_init hook) can be caused by images on the site (or other inclusions) returning a 404 error.
I have right-clicked and "inspected element" on the page to open the Firebug window and had a look through the tabs but I'm not 100% sure how to check for this. I didn't see anything odd or 404'ing under any of the tabs but if someone could just clarify the procedure for checking this I'll be able re-check for definite.
So... any other ideas as to why I'm getting this extra admin_init call and what I can check in the software to see where it's being generated?
Thanks.
I have managed to cure this problem now.
I set the following in wp-config.php:
error_reporting(E_ALL); ini_set('display_errors', 1);
This turned on strict fault reporting.
My site was immediately peppered with Notices about problems.
I systematically went through and fixed every one of them and then my original problem disappeared as well.
I'm unsure of the exact fix but that would probably be site specfiic anyway so thought I'd post this in case it helps anyone else in the future.

Magento 1.8 admin account login shows white dashboard page

Without any change on system configuration and code since my last login, one day my admin account login shows blank dashboard page, header of the page is showed but most of content are blank. Big oddity is my customer service account is able to see her whole dashboard page and get her all backends working, however, as her account has system config part disabled, I can not do anything further.
After clicking login, the URL has showed up: http://www.example.com/index.php/admin/dashboard/index/key/8062533e7ee0df2d1d693d1d70148ad8/
I check HTML rendering, header div of the page has rendered, it stopped at navigation div. the last rendering seen as below.
<div class="nav-bar">
<!-- menu start -->
Could any master help out please, I have no idea where to debug....Thank you so much...
Try:
clean all types of caches
check permissions on folders(app/etc, var,
media) should have 755 or higher.
check logs(exeptions.log,
system.log)
enable errors reporting in
index.php(ini_set('display_errors', 1);)
Thank you all for replying...It is confirmed due to shoplift bug. I applied all patches including latest 5994 patch, nothing changed...I turned on error display in index.php, indicated an error file from includes/src, so I asked hosting admin to turn off php compiler, then I got my admin login back to normal....
However, not sure if this is side effect of the bug, I can not see all images of all products from backend, they all gone. weird thing is all images are good to see from frontend...does anyone know how to do housekeeping after site was being attacked by hacker?

I've moved a WP Website, and now my Homepage is blank

I moved my WordPress website to another server and URL, and now my homepage is coming up blank, even when I preview it in the dashboard.
EDIT: I tried to jerryrig it so that an index.html file would redirect to a faux homepage (start.php), and I'd then change my menus. But when I used my homepage template, I got a blank result, even if the page wasn't set as my home page.
your problem is a plugin Contact Form 7 ( I just deactivate this plugin).
Pdt: Change the admin password.
It's possible these error log errors may have existed on your other site- they don't seem like deal breakers.
Here are some things I often try to troubleshoot when come across problems in moving sites:
Flush permalinks (Settings->Permalinks and hit Save)
Make sure you changed the url in wp_options (home and siteurl)
If your Dashboard is coming up, that's a good sign. Make sure your database has been imported, and that the correct theme is activated
To troublesheet, start deactivating plugins (try deactivating all first and add them on one by one)
Check that the PHP (and MySQL) version of your new server matches your old server (http://php.net/manual/en/function.phpinfo.php)
Check that the settings for PHP shorthand are the same on both servers (broke one of mine for me once: http://www.php.net/manual/en/ini.core.php#ini.short-open-tag)
Check that your php.ini file for your new server matches your old one to some extent- something breaking could be due to a different setting (this option is similar to the previous suggestions)
Good luck!
You likely had this issue before, but error reporting was set not to show E_NOTICE. This is the default, to show all errors except E_NOTICE
error_reporting(E_ALL ^ E_NOTICE);
the best way to move wordpress server is to use a importer .There are many importer plugins for that purpose .I suggest you to have a fresh installation and than import the posts that would solve your problem in the process
There is something that does an output before the header is send....
if you see the message, cannot modify header.... click on show source of the browser and look what invokes the output directly before the first <br />
<br />
<b>Warning</b>: Cannot modify header information … in <b>…</b> on line <b>…</b><br />

Wordpress not letting me save Featured Images

I'm trying to attach a featured image to a post, but after I click the "Use as Featured Image" button, it changes to "saving" and then just stays there.
Normally it only takes a second or so.
I've looked into memory issues but that doesn't seem to be the issue. Is there anything else that seems to cause this?
I'm testing on the basic 2011 theme and no plugins and the newest Wordpress.
Chrome IS giving me some kind of error, but I don't know how to interpret it.
POST *website*/wp-admin/admin-ajax.php load-scripts.php:4
f.support.ajax.f.ajaxTransport.send load-scripts.php:4
f.extend.ajax load-scripts.php:4
f.each.f.(anonymous function) load-scripts.php:4
WPSetAsThumbnail load-scripts.php:6
onclick
Troubleshooting:
Have you updated your WP installation recently? It may be possible that your browser still holds an older version of the admin scripts which creates the error.
Try clearing your cache and try again:
http://support.google.com/accounts/bin/answer.py?hl=en&answer=32050

Categories