Caching-Plugins and Ajax-Page-Parts

You can use following code to exclude page from caching. define(‘DONOTCACHEPAGE’, true); //Disables page caching for a given page. define(‘DONOTCACHEDB’, true); //Disables database caching for given page. define(‘DONOTMINIFY’, true); //Disables minify for a given page. define(‘DONOTCDN’, true); //Disables content delivery network for a given page. define(‘DONOTCACHCEOBJECT’, true); //Disables object cache for a given page and … Read more

wp_handle_upload returns empty error array

Okay so Milo was on track to what the answer was. and I needed to brush up on muliple file uploads… anyway the solution for me to at least get it to upload… was this $daFile = $_FILES[‘files’]; foreach ($_FILES[‘files’] as $key => $value) { $daFile[$key] = $value[0]; } $upload = wp_handle_upload($daFile , array(‘test_form’ => … Read more

Get the_content with ajax

I’m sorry but I think you have not read a good tutorial. If you are new to WordPress AJAX, I recomend you reading AJAX in WP Codex and examples plus all the examples you can find in this site.

Ajax custom search not functioning as expected

OK… this turns out to be due to a chunk of code I thought was unrelated. In an effort to keep users out of wp-admin I had added: function foobar_redirect_admin() { if( !current_user_can( ‘edit_posts’ ) ) { wp_redirect( site_url() ); exit; } } add_action( ‘admin_init’, ‘foobar_redirect_admin’ ); And that would redirect non-admin users away from … Read more

Plugin: AJAX query external API to sync to tables

Sketch/Concept To make requests to remote/external APIs, use the WP HTTP API. More in depth examples/details can be found in some of my answers here. Then simply add an admin page with add_submenu_page() or add_menu_page() or the related functions. Finally add a script via wp_register/enqueue_script() on the admin_enqueue_scripts-hook. There you fire an ajax (search archives) … Read more

Ajax simple experiment

$post isn’t set in your AJAX handler, it doesn’t exist. An AJAX request is a separate request from the one that rendered the page you’re making the request from, php data doesn’t persist across these two requests. You’re passing post_id in your AJAX request, so I assume you want something like: function retrieve_id(){ echo $_POST[‘post_id’]; … Read more

Edit a different page in WP Customizer

The Customizer will apply its changes into the frame over the entire site. Try it yourself with Twenty Thirteen and see. Make some changes, and without saving, navigate to a single post or single page and see how the changes persist even without saving. So likely you’re doing something else that breaks that functionality in … Read more