• Resolved hir88en

    (@hir88en)


    Hi,

    Is there anyway to add custom field but only show on admin’s edit advert page?

    For example I want to add ‘Admin note’ field on the edit-advert page

Viewing 1 replies (of 1 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    it is the easiest to do that with the Custom Fields extension https://wpadverts.com/extensions/custom-fields/ when creating a new field it will allow you to select where the field should be show, one of the options is the “Admin form only”.

    If you are working with the Forms API https://wpadverts.com/doc/custom-fields/ to add a new field then inside of your adverts_form_load filter you can use the is_admin() function to check if the field should be added to the form

    
    add_filter( "adverts_form_load", function( $form ) {
      if( ! is_admin() ) {
        return $form;
      }
      // add here the field only admin should see
      return $form;
    } );
    
Viewing 1 replies (of 1 total)
  • The topic ‘custom field only for backend’ is closed to new replies.