1

When creating a page or a post WordPress lets the content (title, body, featured image) be saved when using Ctrl + S. The Custom Fields do not save in the same way (in this case I'm using Advanced Custom Fields as well, but it happens without this plugin).

Does anyone have a solution for saving this data in the same way? In this case Publishing isn't an option.

UPDATE: If I click the "Save draft" button the Custom Fields save. The ctrl + S save only seems to be in scope when in the content area. Is there an easy way to change this to be a global post ctrl S? The "Save Draft" button thankfully removes the urgency, but that would be nice!

0

I just wrote a plugin that does just that. It's been submitted to the WordPress.org plugin repo earlier this week and hopefully should make an appearance soon. The plugin is officially in the WordPress.org repo. In short what you are looking for is a way to have the following code available on your post editor:

jQuery(window).bind('keydown', function(event) {
    if (event.ctrlKey || event.metaKey) {
        if(String.fromCharCode(event.which).toLowerCase() === 's' ) {
            event.preventDefault();

            if ( typeof wpkeysave_save_trigger !== 'undefined' ){
                // harsh way to save draft/publish/update
                jQuery( '#' + wpkeysave_save_trigger ).trigger( 'click' );
            }

        }
    }
});

Update: The plugin is officially in the WordPress.org repo and will be actively maintained.

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.