Support » Fixing WordPress » Change default button on post.php to “Publish”

  • When writing a new post (post.php) the default button is “Save” not “Publish”. It was Publish in previous versions of WordPress and I’d like to change it back.

    I’ve tried various searches on this forum and found nothing, Google through up a few links to this forum but nothing has led me to the answer. Can anyone tell me how to do this?

    Just to clarify, I don’t want to change the default “Post Status” under the “Post Status” heading. I’d like the option to hit the “Save” button and have my post saved as a draft, just as it worked prevoius to version 1.5.

    Many thanks,

    Callum.

Viewing 2 replies - 1 through 2 (of 2 total)
  • MichaelH

    (@michaelh)

    In 1.5.2, if you were using Advance Controls, the Save button was the default and Draft was the default Post Status. So advanced controls what 2.0.2 uses.

    With that said, in Version 2.0.2, you can could change wp-adminadmin-functions.php at approximately line 299

    from
    $post->post_status = 'draft';

    to
    $post->post_status = 'publish';

    That will Publish a Post if either the Save or Publish button is clicked. I didn’t do much heavy testing of that …

    ——————–
    Please note that modifying core files is generally discouraged, so make a backup of the file(s) before changing anything–just in case it doesn’t work you’ll have something to fall back on. Also, remember you will need to ‘retrofit’ that change upon subsequent WordPress upgrades.
    ——————–

    Thread Starter Callum Macdonald

    (@chmac)

    MichaelH: Thanks for that, I had found a few posts on the forum about changing the default post status. What I want to do is change the default button, not the status, so I can still choose to hit “Save” and save the post as a draft.

    I had a look in the source, and it turns out that the default button is actually the one which appears first, so that’s normally “Save and Continue Editing”. I’ve changed the tab order and set the Publish button to be bold, which is what makes it appear to be the default.

    For reference, the changes are in /wp-admin/edit-form-advanced.php

    Line 45 change:
    tabindex="3" to tabindex="4"

    Line 199 change:
    tabindex="4" to tabindex="5"
    and remove "style="font-weight:bold;"

    Line 204 change:
    tabindex="5" to tabindex="3"
    and then add "style="font-weight:bold;" immediately after the code you’ve just changed

    This changes the tab order so when you press tab in the content text area it will automatically take you to the “Publish” button. However, in editing all this code I realise that you can simply use the shortcut “P” (Alt-P on Windows/Firefox).

    Enjoy, Callum.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change default button on post.php to “Publish”’ is closed to new replies.