Why should I need to add init action to include PHP file to WordPress Plugin?
Why should I need to add init action to include PHP file to WordPress Plugin?
Why should I need to add init action to include PHP file to WordPress Plugin?
add_action don’t updates theme layout when using values from the WordPress customizer
We had a similar problem here. The reason was that when loading a page in the frontend, WordPress actually was doing two requests: One to load the page A second one in the background after the page was loaded using admin-ajax.php The solution was to make sure, out function was only executed during the “normal” … Read more
Remove action added in plugin class from theme
Not really sure why this fixed it, but it did: function modify_post_content( $content ) { $screen = get_current_screen(); $post_type = $screen->post_type; if ($post_type == ‘story’){ require_once(‘regex.php’); $response_array = regex($content); $content = $response_array[‘finalString’]; } return $content; } add_filter(‘content_save_pre’, ‘modify_post_content’, 10, 1);
Use the password_reset hook. function wpse_password_reset( $user, $new_pass ) { //* Do something useful with $new_pass } add_action( ‘password_reset’, ‘wpse_password_reset’, 10, 2 ); Edited to add after the comment: Looks like the reason I can’t use that is that the plugin uses wp_update_user to set the new password. Is there any way I can intercept … Read more
It looks like the MBAjax.ajaxurl and MBAjax.admin_url are probably not set. If it can’t post to the correct WordPress handler, then you will probably get a 404 page HTML returned instead of the PHP function return value. You can test by hard-coding the ajax url to url: “/wp-admin/admin-ajax.php”, and see if that fixes things. Secondly, … Read more
According to the Codex, This function is defined on most admin pages, but not all. Thus there are cases where is_admin() will return true, but attempting to call get_current_screen() will result in a fatal error because it is not defined. One known example is wp-admin/customize.php.
You can find out what actions are assigned to given hook with this code: function print_filters_for( $hook = ” ) { global $wp_filter; if( empty( $hook ) || ! array_key_exists( $hook, $wp_filter ) ) { return; } print ‘<pre>’; print_r( $wp_filter[$hook] ); print ‘</pre>’; } Call it where you need it. In your case: <form> … Read more
Remove action hook from Class, understanding OOP