Make Owner as Required field

    • Daniele Cavazzin
      Participant
      # il y a 3 années

      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
      # il y a 3 années

      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
      }
Vous lisez 1 fil de discussion

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