WordPress.org

Ready to get started?Download WordPress

Forums

WP User Frontend
Require to upload pictures before post (4 posts)

  1. simkamsan
    Member
    Posted 1 year ago #

    Dear All,

    We need you help on my website: http://www.khmerpin.com in add+ option. We required upload picture so what can we do? any advise?

    Andy

    http://wordpress.org/extend/plugins/wp-user-frontend/

  2. staceym
    Member
    Posted 1 year ago #

    Add this to functions.php in your theme file.

    // Require an attachment upload
    function my_add_post_validation($errors) {
     if ( empty($_POST['wpuf_attach_title']) ) {
      $errors[] = __( 'Photo upload is required', 'wpuf' );
     }
     return $errors;
    }
    add_filter( 'wpuf_add_post_validation', 'my_add_post_validation');

    If you want to require a featured image instead of an attachment, use $_POST['wpuf_featured_img'].

  3. canbe3d
    Member
    Posted 1 year ago #

    Hi staceym
    I have a question for you that where should we add that code in the functions.php? and is functions.php of Theme or the plugin?
    Thanks

  4. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 1 year ago #

    quote: staceym

    Add this to functions.php in your theme file.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic