Support

Account

Home Forums General Issues How can I set a default image for an image field? Reply To: How can I set a default image for an image field?

  • I am not sure you can set a default image.

    I think that your template should take care of this for you. I would just setup ACF option with the default image (or define a variable in your template if it’s not something that your client needs to change).

    When you are displaying the logo, you can do something like this:

    
    if ( '' === get_field( 'logo' )  {
      $image_url = get_field( 'default_image', 'option' );
      // Render the default image.
    }
    

    Non option version:

    
    $default_image = (your default image URI);
    if ( '' === get_field( 'logo' )  {
      // Render the default image using $default_image
    }