Real time Duplicate title check

You can hook ‘save_post’ or ‘wp_insert_post’ (both executed the same in wp_insert_post()) to check for autosaves and notify the author(s) accordingly. The checks that I would do would be to check that the author of the autosave (aka, revision) and the new autosave are not the same, check that the post title is the same … Read more

How to add a sub menu with AJAX?

As you can’t suppose to get a full working example without any given code, I’ll show you a rough wordpress AJAX setup: Put all this in functions.php: <?php add_action(‘wp_head’, ‘my_action_javascript’); function my_action_javascript() { ?> <script type=”text/javascript” > jQuery(document).ready(function($) { jQuery.ajax( type: ‘POST’, url: <?php echo admin_url(‘admin-ajax.php’); ?>, data: { action : ‘your_AJAX_call’, league : $(‘input#league’).val() … Read more

How to modify wp_ajax function?

You can jump in front of an AJAX hook by specifying a higher priority (i.e. lower number), like this: add_action( ‘wp_ajax_find_posts’, ‘wp_ajax_find_posts’, 0 ); NB: works because 0 < 1

get data from wp-query, outside the loop & without url change

It sounds like you’re looking for wp_localize_script() which lets you pass data to a script that is already enqueued. It works roughly like this: <?php // assuming your script is already registered wp_enqueue_script( ‘wpse_81817’ ); // Do the array building of terms you plan on doing $wpse_81817_phpdata = array( ‘myKey’ => ‘a value’ ); // … Read more

How can I run shortcode after click with ajax

You should try to replace the following jQuery part: action: ‘process_shortcode_on_tab_click’ with this one: action: ‘process_shortcode_on_tab_click_action’ to match your wp_ajax_process_shortcode_on_tab_click_action and wp_ajax_nopriv_process_shortcode_on_tab_click_action actions. Check for example the Codex on how to name the custom wp_ajax_$youraction hook.

Ajax form submission from admin panel

File Upload via Ajax is a bit tricky, but manageable. Add some additional form fields (nonce and ajax_action) to your form in suite_export_import_menu(): function suite_export_import_menu(){ ?> <h2>Suite Report Export/Import </h2> <div id=”export_import_form”> <p id=”custom_ajax_call_process”>Uploading…</p> <p id=”custom_ajax_call_result”></p> <form action=”<?php echo admin_url(‘admin-ajax.php’); ?>” method=”post” enctype=”multipart/form-data” target=”upload_target”> <input type=”hidden” name=”action” value=”export_vacancy”> <input type=”hidden” name=”subaction” value=”imp_vacancy”> <input type=”file” name=”file_source” … Read more

Comparing arrays within a loop

For anyone else, or for someone to maybe give a better, neater, more professional answer, this is what I have ended up doing: First I added a function to compare the new search data ($newSearch): function identical_values( $arrayA , $arrayB ) { sort( $arrayA ); sort( $arrayB ); return $arrayA == $arrayB; } Kept the … Read more