Make Owner as Required field

    • Daniele Cavazzin
      Participant
      # 1 year, 2 months ago

      Hi, is possible to set Owner as required field?
      I would like the private file not saving and give an error if no owner is set.

       

    • Daniele Cavazzin
      Participant
      # 1 year, 2 months ago

      At the end I found a solution:

      add_action( 'admin_head-post-new.php', 'cuar_owner_required' );
      
      function cuar_owner_required()
      {
      global $current_screen;
      
      // If not our post type, do nothing
      if( 'cuar_private_file' != $current_screen->post_type )
      // return;
      ?>
      <script language="javascript" type="text/javascript">
      jQuery(document).ready(function($)
      {
      
      // Tick the checkboxes of categories 3 and 9
      $('#cuar_owner_select_usr').attr('required','true');
      
      });
      </script>
      <?php
      }
Viewing 1 reply thread

The topic ‘Make Owner as Required field’ is closed to new replies.