I am customising my product post type and auto generating the post title using add_action('acf/save_post').

See my php below for this...

class Product {

    /**
     * product constructor method.
     */
    public function __construct() {

        // process product details when saving the post
        add_action('acf/save_post', array($this,'action_product_title'), 20);

    }

    /**
     * Action to run modifications when saving the post
     * @return void
     */
    public function action_product_title ($post_id) {

        // my product title modifications...

        // finally, return
        return;

    }

}

new Product();

My question is, is there a hook or action that I can add to my construct to make the post title input field disabled using php.

The idea being, the post title input is still visible, but the input is disabled from manual editing.

Thanks in advance for any help.

  • When registering the post type, just don't add title to supports. – Jacob Peattie Nov 30 at 12:24
  • I still want to support it so the user can see the generated title, but just need the post title input disabled. – joshmoto Nov 30 at 12:33
  • 1
    add your own meta box that displays the auto-generated title. – Milo Nov 30 at 20:41
  • Thanks milo yeah this is my fall back but I might just use javascript, I was curios wether there was action to rebuild the native post title field :-) – joshmoto Nov 30 at 23:30

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.