admin_notices is not working inside function

Well, this is happening because of hook firing sequence. Hooks actually get loaded from an array(have a look) where admin_notices executes before add_menu_page gets called. Now to show you message in your admin page you can check global $pagenow and the page GET variable by $_GET[‘page’] with an if condition and print your message. Like … Read more

Troubleshooting Admin_Notice

Yup. I threw my test code in the top of the Hello Dolly plugin and there was the notice. That’s when I remembered that I was calling it within a namespace: So needed to referenced that so the WP action could access it: namespace My_Plugin; function my_mwe_admin_notice(){ echo ‘<div class=”notice notice-error”>’; echo ‘<h1>Notice this.</h1>’; echo … Read more

How to display only specific Error types in debug.log? No notices, warnings, etc

In short: this is the most detailed documentation on the topic (most likely..) The only source you need. Oh, and here is an amazing Php Error Level calculator to set up the php error mask binary code fast (if needed) Based on this, i made my custom error reporting: In functions.php function error_report_log_customize(){ // error_reporting(E_ALL); … Read more

Changing the HTML of notices in WooCommerce [closed]

After talking with some of the WooCommerce people on Slack, I realized that the problem here is probably this pattern, in frontend/cart.js – due to the fact, that my store uses the AJAX functionality that WooCommerce provides. var show_notice = function( html_element, $target ) { if ( ! $target ) { $target = $( ‘.woocommerce-notices-wrapper:first’ … Read more

How $_GET[‘updated’] variable is passed when updating a user?

I have found a javascript solution. Here is the code: member.js (needs jQuery) $jq = jQuery.noConflict(); $jq(document).ready(function () { redirect_on_save_func(); }); function redirect_on_save_func() { var qvars = get_query_func(); var nq = []; $jq.each(qvars, function (vk, vv) { if (vk.match(‘meta_warning*’) == null) nq.push(vk + ‘=’ + encodeURIComponent(vv)); }); var hr = window.location.href; var nqs = hr.split(‘?’)[0] … Read more