Hot answers tagged

1

Please do not put this code into production OK. So there are many things wrong with the code that need fixing before we can even begin to answer your question. Firstly we're using $_REQUEST without good reason -- $_REQUEST gives us access to all of the information sent in the request, which means that $_POST['foo'] $_REQUEST['foo'] === $_GET['foo'] and ...


1

To use AJAX in a WordPress website you can the admin-ajax.php file. This file handles your requests and sends it to the correct function. A short step-by-step guide on how to achieve: First you need to localize your javascript file so that it knows the URL of the admin-ajax.php file on your server. add_action( 'wp_enqueue_scripts', 'wpse_229573_localize' )...


1

I couldn't find any WP specific event to hook in to. What you can do is set up an observer with a callback to respond to DOM changes using MutationObserver and check if the your featured image has been added in the callback. There's no support in IE < 11 though, which may be a deal breaker for you, or maybe not. I've done minimal testing on this, but it ...


1

Very broad solution. There are two problems you are facing there are different HTML generated by the server based on if there is a featured image Meta box are just a UI artifact of post editing and are not easily manipulated via AJAX (even in AJAX it is easier to handle full objects rather then their individual properties, even if only for keeping ...


1

I've read through your post in it's entirety, I certainly don't see anything particularly wrong with it, but it sounds to me like your more frustrated with how it's been laid out. I personally have a big objected oriented programming background, it allows me to establish a structure and makes my code much more re-usable. My suggestion to you would be to ...



Only top voted, non community-wiki answers of a minimum length are eligible