Title: find_posts_div
Published: April 25, 2014
Last modified: August 20, 2026

---

# find_posts_div( string $found_action = ” )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/find_posts_div/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/find_posts_div/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/find_posts_div/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/find_posts_div/?output_format=md#changelog)

Outputs the modal window used for attaching media to posts or pages in the media-
listing screen.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/find_posts_div/?output_format=md#parameters)󠁿

 `$found_action`stringoptional

The value of the `'found_action'` input field.

Default:`''`

## 󠀁[Source](https://developer.wordpress.org/reference/functions/find_posts_div/?output_format=md#source)󠁿

    ```php
    function find_posts_div( $found_action = '' ) {
    	?>
    	<div id="find-posts" class="find-box" style="display: none;">
    		<div id="find-posts-head" class="find-box-head">
    			<?php _e( 'Attach to existing content' ); ?>
    			<button type="button" id="find-posts-close"><span class="screen-reader-text">
    				<?php
    				/* translators: Hidden accessibility text. */
    				_e( 'Close media attachment panel' );
    				?>
    			</span></button>
    		</div>
    		<div class="find-box-inside">
    			<div class="find-box-search">
    				<?php if ( $found_action ) { ?>
    					<input type="hidden" name="found_action" value="<?php echo esc_attr( $found_action ); ?>" />
    				<?php } ?>
    				<input type="hidden" name="affected" id="affected" value="" />
    				<?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
    				<label class="screen-reader-text" for="find-posts-input">
    					<?php
    					/* translators: Hidden accessibility text. */
    					_e( 'Search' );
    					?>
    				</label>
    				<input type="text" id="find-posts-input" name="ps" value="" />
    				<span class="spinner"></span>
    				<input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" />
    				<div class="clear"></div>
    			</div>
    			<div id="find-posts-response"></div>
    		</div>
    		<div class="find-box-buttons">
    			<?php submit_button( __( 'Select' ), 'primary alignright', 'find-posts-submit', false ); ?>
    			<div class="clear"></div>
    		</div>
    	</div>
    	<?php
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/template.php#L2030)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/template.php#L2030-L2068)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/find_posts_div/?output_format=md#related)󠁿

| Uses | Description | 
| [submit_button()](https://developer.wordpress.org/reference/functions/submit_button/)`wp-admin/includes/template.php` |

Echoes a submit button, with provided text and appropriate class(es).

  | 
| [esc_attr_e()](https://developer.wordpress.org/reference/functions/esc_attr_e/)`wp-includes/l10n.php` |

Displays translated text that has been escaped for safe use in an attribute.

  | 
| [wp_nonce_field()](https://developer.wordpress.org/reference/functions/wp_nonce_field/)`wp-includes/functions.php` |

Retrieves or display nonce hidden field for forms.

  | 
| [_e()](https://developer.wordpress.org/reference/functions/_e/)`wp-includes/l10n.php` |

Displays translated text.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)`wp-includes/formatting.php` |

Escaping for HTML attributes.

  |

[Show 3 more](https://developer.wordpress.org/reference/functions/find_posts_div/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/find_posts_div/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/find_posts_div/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ffind_posts_div%2F)
before being able to contribute a note or feedback.