Title: Filter an array
Last modified: August 20, 2016

---

# Filter an array

 *  Resolved [David Dumonde](https://wordpress.org/support/users/everlearners/)
 * (@everlearners)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/filter-an-array/)
 * I get the basic idea of filters, but I’m stumped on filtering an array:
 *     ```
       function genesis_post_categories_shortcode( $atts ) {
       	$defaults = array(
       		'sep'    => ', ',
       		'before' => __( 'Filed Under: ', 'genesis' ),
       		'after'  => '',
       	);
       ```
   
 * _[Moderator Note: Please post code or markup snippets between backticks or use
   the code button.]_
 * How do I filter only the ‘before’ part of this function?
 * Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/filter-an-array/#post-2780533)
 * Have you tried the support offerings of StudioPress, since this function is part
   of the commercial Genesis Theme?
 *  [datdesignguy](https://wordpress.org/support/users/datdesignguy/)
 * (@datdesignguy)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/filter-an-array/#post-2780556)
 * Hi,
 * I think you want the [apply_filters](http://codex.wordpress.org/Function_Reference/apply_filters)
   function…
 * Here’s how your array will look with this filter in place:
 *     ```
       function genesis_post_categories_shortcode( $atts ) {
       	$defaults = array(
       		'sep'    => ', ',
       		'before' => apply_filters( 'filter_name', __( 'Filed Under: ', 'genesis' ) ),
       		'after'  => '',
       	);
       ```
   
 * Just replace ‘filter_name’ with the name of the filter you wish to apply.
 * In addition be sure whether the filter you are using requires additional variables
   as per the codex page I linked to above 🙂
 * Hope this helps!
 * – Greg

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Filter an array’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [function](https://wordpress.org/support/topic-tag/function/)
 * [genesis](https://wordpress.org/support/topic-tag/genesis/)

 * 2 replies
 * 3 participants
 * Last reply from: [datdesignguy](https://wordpress.org/support/users/datdesignguy/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/filter-an-array/#post-2780556)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
