Filter hook 'get_post_galleries'

in WP Core File wp-includes/media.php at line 5392

View Source

get_post_galleries

Filter Hook
Description
Filters the list of all found galleries in the given post.

Hook Information

File Location wp-includes/media.php View on GitHub
Hook Type Filter
Line Number 5392

Hook Parameters

Type Name Description
array $galleries Associative array of all found post galleries.
WP_Post $post Post object.

Usage Examples

Basic Usage
<?php
// Hook into get_post_galleries
add_filter('get_post_galleries', 'my_custom_filter', 10, 2);

function my_custom_filter($galleries, $post) {
    // Your custom filtering logic here
    return $galleries;
}

Source Code Context

wp-includes/media.php:5392 - How this hook is used in WordPress core
<?php
5387  	 * @since 3.6.0
5388  	 *
5389  	 * @param array   $galleries Associative array of all found post galleries.
5390  	 * @param WP_Post $post      Post object.
5391  	 */
5392  	return apply_filters( 'get_post_galleries', $galleries, $post );
5393  }
5394  
5395  /**
5396   * Checks a specified post's content for gallery and, if present, return the first
5397   *

PHP Documentation

<?php
/**
	 * Filters the list of all found galleries in the given post.
	 *
	 * @since 3.6.0
	 *
	 * @param array   $galleries Associative array of all found post galleries.
	 * @param WP_Post $post      Post object.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/media.php
Related Hooks

Related hooks will be displayed here in future updates.