Here is my JS:

jQuery('#post_status option[value="draft"]').text('Approve');

I simply trying to modify the text inside the option element in the status select form element in the Edit Post page.

For some reason it does not work. I am using 'admin_footer' action to add the JS.

Maybe there is another way?

I also tried this:

jQuery('#post_status option[value="changes-required"]').prop('selected', true);
  • Have you tried typing that into the console to see if it does anything? That might narrow down if the element you want exists when you are calling the script. – Douglas.Sesar Jul 7 '14 at 19:23

Your first line works for me when I type it in the console of Chrome:

jQuery('#post_status option[value="draft"]').text('Approve');

so I assume your problem may be that the element you want might not be loaded yet from where you run your script. Try wrapping it in this:

jQuery(document).ready(function() { 
    (function ($) { 

        $('#post_status option[value="draft"]').text('Approve');

  • Still does not work. – jnbdz Jul 11 '14 at 14:20
  • Have you tried pasting jQuery('#post_status option[value="draft"]').text('Approve'); into the console after the page is loaded? – Douglas.Sesar Jul 12 '14 at 16:11
  • I have not. Let me try it out. – jnbdz Jul 12 '14 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.