Ajax call does not activate callback function

Since you’re serializing the form, as ajax data, you could be missing the action part from your form: <input type=”hidden” name=”action” value=”bda_alert”> so your ajax request would contain /wp-admin/admin-ajax.php?action=bda_alert&… that should invoke the wp_ajax_bda_alert or wp_ajax_nopriv_bda_alert action callback.

Get posts with ajax

Option 1 The simple way – return all the posts in JSON format and loop through them in JavaScript PHP: function get_ajax_posts() { // Query Arguments $args = array( ‘post_type’ => array(‘products’), ‘post_status’ => array(‘publish’), ‘posts_per_page’ => 40, ‘nopaging’ => true, ‘order’ => ‘DESC’, ‘orderby’ => ‘date’, ‘cat’ => 1, ); // The Query $ajaxposts … Read more

wp_mail script with jQuery post

Basically, you can use JavaScript to post to a WordPress function, then the WordPress function can invoke wp_mail() to send the message. A great place to start would be the useful AJAX in Plugins article on the Codex. It walks you through all the steps required to add your JavaScript on the front-end, your PHP … Read more

External/non-WP rewrite rules

Here are some notes. Install Toschos rewrite plugin Install Jan Fabrys rewrite analyzer plugin. Use the Rewrite API Add your rules to top. There’s also the function add_external_rule(), which should be accessible via $GLOBALS[‘wp_rewrite’]->add_external_rule(); All your external rules are accessible via $wp_rewrite->non_wp_rules. Here’re the internals, that show you how the rules get added inside $wp_rewrite->mod_rewrite_rules(): … Read more