Exposing data using a custom WordPress API

You need a die(); before the closing } of the function and you might want to add the relevant php header to tell the browser it’s content-type I wouldn’t worry about the browser returning the wrong content type. As long as your code loading the data treats it as JSON So for your function try … Read more

AJAX search as you type? [duplicate]

I have developed an ajax search plugin a few weeks ago. There is a free version available at the wordpress plugin repository. Feel free to explore the source code 🙂 You can find it here: Ajax Search Lite There is also a commercial version, maybe you are interested: Ajax Search Pro You can check out … Read more

Add/remove action on jQuery toggle

I ended up not adding/removing the action at all, but rather writing an option to the database and having a second plugin check if the option is set: function av_maintenance_mode_check() { if( !wp_verify_nonce( $_GET[‘nonce’], ‘av-maintenance-mode-nonce’ )) die( ‘Go away!’); if( get_option( ‘av_maintenance_mode’ ) == ‘on’ ) { echo ‘<span style=”color:green”>On</span>’; }else{ echo ‘<span style=”color:red”>Off</span>’; } … Read more

Dynamic dependent Dropdown lists for categories, sub-categories and posts

you may find your answer here and Here’s a demo of it. HTML code example <div class=”ccms_form_element cfdiv_custom” id=”style_container_div”> <label for=”brand”>Make:</label> <select size=”1″ id=”make” class=” validate[‘required’]” title=”” onChange=”updatepage();” type=”select” name=”style”> <option value=”-1″>–Choose a Make-</option> <option class=”Audio” value=”Audi”>Audi</option> <option class=”BMW” value=”BMW”>BMW</option> </select> <div class=”clear”></div><div id=”error-message-style”></div> <div id=”style-sub-1″ class=”BMW” style=”display: none;” name=”stylesub1″ onchange=”ChangeDropdowns(this.value)”> <label for=”brand”>Model:</label> <select name=”cat” … Read more

AJAX Call is Only Returning 100 Results from Query

As otto implied in his comment, your code execution time is probably greater then the max php execution set in max_execution_time configuration directive in your php.ini, which is usually 30 seconds. You might be able to change that directive in php.ini or .htaccess, but it will only create a new problem as the user will … Read more