Bootstrap modal with jQuery post [closed]

If process.php is not found, your reference in the file is not correct. Make sure you reference to the correct path, for istance – if the file is in the rootdirectory of your site, add a slash in front of your code: url: “process.php”, will be: url: “/process.php”, If it is in the ‘ajax’ directory: … Read more

Applying jquery to WordPress admin edit.php

The previous answer works good with my example above using this hook: add_action( ‘admin_head’, ‘woocommerce_admin_init’ ); function woocommerce_admin_init() { $screen = get_current_screen(); if ( $screen->post_type == “shop_order” ) { ?> <script type=”text/javascript”> jQuery(document).ready(function ($) { $(“.edit_address”).click(); $(“.add-line-item”).click(); }); </script> <?php } }

Delete post image attachments with jQuery from the front end

Now you need to handle the AJAX call in PHP. add_action( ‘wp_ajax_delete_attachment’, ‘delete_attachment’ ); function delete_attachment( $post ) { //echo $_POST[‘att_ID’]; $msg = ‘Attachment ID [‘ . $_POST[‘att_ID’] . ‘] has been deleted!’; if( wp_delete_attachment( $_POST[‘att_ID’], true )) { echo $msg; } die(); } As for your event, just add it to the click function … Read more

Custom AJAX form not working async

First probable issue: You’re using name in the form. You should not, since it’s a reserved term in WordPress. Second probable issue: You’re using a form action URL of <?php echo get_template_directory_uri(); ?>/assets/php/process-contact.php. That will break if you use any WordPress functions (or functions defined in functions.php and plugins). This is the correct way to … Read more

WP Customizer: Save a control state

Found a solution. Turns out the activate, deactivate functions are not persistent, meaning the controls’ state are reset if the page is refreshed! Therefore I used ‘active_callback’ => ‘fname’ in my customizer.php in order to make changes persistent where fname is the function name as seen below. function fname() { if ( !strcmp ( get_theme_mod(‘above-header’), … Read more

How do I get my suggest to only suggest one taxonomy?

After join term_id exist two times. You should specify which term_id you are querying by prefixing full table name (or alias). Also there is a other error term_taxonomy.term_id = terms.term_id missing table prefix. So the updated query will look like $query = ‘SELECT term_taxonomy_id, ‘ . $wpdb->prefix . ‘terms.term_id, taxonomy, name FROM ‘ . $wpdb->term_taxonomy … Read more

Change shortcode value by jquery in WP Editor

Shortcodes are backend stuff, so you can’t just change values of shortcodes itself in editor with jQuery, the thing you can do is to call both shortcodes, hide one of them, and on click show him and hide other one. It all depends what do you want to do, but one of the option is … Read more