Custom Fields
Re-Envisioned
Support General Problem with title clearing on Dashboard update

  • Creator
    Topic
  • #26636
    Resolved Martin
    Participant

    Hi,

    I’m having essentially the same issue as with this topic – https://metabox.io/support/topic/titel-of-post-is-removed-after-updating-the-post/

    The solution worked fine for when the form is used in the frontend but in the CPT edit screen it still clears the title when I update. I’ve created the text field with id post_title and when I let it remain visible I can see that it doesn’t populate in the backend dashboard and I’m assuming that’s why it clears the title on update.

    I think from the other topic that I need to have the attribute post_id=’current’ but as the Dashboard isn’t using the shortcode for display I’m not sure how to apply this (assuming that will work in the Dashboard as well).

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #26651
    Long Nguyen
    Moderator

    Hi Martin,

    The custom field with the ID post_title only works on the frontend (just a trick). On the backend, WordPress has the main field (pre-built) post_title so it does not show the custom field with the same ID.

    You can also follow this solution to only use the custom field and remove the main field Post Title https://docs.metabox.io/save-wysiwyg-content-post-content/.

    Add this code to the file functions.php or use the plugin Code Snippets.

    add_action( 'init', function () {
        remove_post_type_support( 'post', 'title' );
    } );
    #26704
    Martin
    Participant

    That helped a lot. Thanks.

    I managed to use this information to extend things a little and generate an automated title based on other fields in the CPT.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.