wpdb->insert creates duplicate rows

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

Add Action wp_update_post not Updating WYSWIAG editor

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);

Hook into all password resets in WordPress and get password before hashing?

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

Ajax call to php function doesn’t work PHP code

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