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

Theme Customizer – Conditional Controls

I can suggest you another direction : why bother generating a new Control in javascript when you can create controls A and B at the first page load and hide/show them dynamically using javascript ? If I understand well, this was what you described in option 3. Here is a sample code to get you … Read more

Admin WP List Table Columns Missing

This is a bug with the wordpress AJAX trying to update manageedit-pagecolumnshidden on the admin table pages when columns are hidden. It completly breaks the entire admin tables when the table headers are visually hidden. Thanks to Michael Ecklund’s clue I was able to figure it out. I created the Ticket here: https://core.trac.wordpress.org/ticket/29030 And a … Read more