• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Stop Genesis from using first attached post image if no featured image

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Stop Genesis from using first attached post image if no featured image

This topic is: not resolved

Tagged: featured image, genesis_get_image, genesis_get_image_default_args

  • This topic has 2 replies, 2 voices, and was last updated 5 years, 5 months ago by pxforti.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • June 30, 2020 at 9:06 am #499749
    pxforti
    Participant

    Monochrome Pro theme.

    Archive pages are showing image even if no featured image is displayed. I only want the image shown if a featured image is assigned. If no featured image, then no image display on archive / category page.

    I tried using this code, which is supposed to do exactly this, but it doesn't work. Any idea how to make this work?:

    add_filter( 'genesis_get_image_default_args', 'prefix_stop_auto_featured_image' );
    /**
     * Stop Genesis archives from using first attached image as fallback when no featured image is set.
     *
     * @param  array $args Default image arguments.
     *
     * @return array       Amended default image arguments.
     */
    function prefix_stop_auto_featured_image( $args ) {
    	if ( ! isset( $args['context'] ) || 'archive' !== $args['context'] )
    		return $args;
    	$args['fallback'] = false;
    	return $args;
    }

    writeNowDesign
    WordPress and Ecommerce Website Design

    June 30, 2020 at 7:34 pm #499781
    Brad Dalton
    Participant

    I would ask the author of the code if it still works. Otherwise, try one of these solutions.


    Tutorials for StudioPress Themes.

    July 1, 2020 at 6:58 am #499788
    pxforti
    Participant

    Thanks for the response.

    I figured out how to get the original code to work. In case anyone else has this problem, I removed the if statement, which says to ignore the code if it's an archive. Not sure why that's in there since that's the reason for the code:

    Below is the revised code:

    add_filter( 'genesis_get_image_default_args', 'prefix_stop_auto_featured_image' );
    /**
    * Stop Genesis archives from using first attached image as fallback when no featured image is set.
    *
    * @param array $args Default image arguments.
    *
    * @return array Amended default image arguments.
    */
    function prefix_stop_auto_featured_image( $args ) {
    $args['fallback'] = false;
    return $args;
    }


    writeNowDesign
    WordPress and Ecommerce Website Design

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble