Fire jQuery function when post edit screen loads
You have your jQuery hooked too early. The jQuery library has not yet loaded when the load-(page) action is fired. Use admin_print_scripts to print inline scripts. That action comes after scripts are enqueued. Here’s your original code using admin_print_scripts: add_action( ‘admin_print_scripts’, function () { $status = “status-started”; if($status == ‘status-started’): ?> <script> jQuery(document).ready(function($) { /* … Read more