<?php
function modified_post_gallery( $blank = NULL, $attr )
{
echo '<pre>';
print_r( $attr );
echo '</pre>';
}
add_filter( 'post_gallery', 'modified_post_gallery', 10, 2);
?>
In media.php it shows the filter like this:
// Allow plugins/themes to override the default gallery template.
$output = apply_filters('post_gallery', '', $attr);
Its passing two variables not one and $attr is on the second variable.
Related Posts:
- current_shortcode() – detect currently used shortcode
- Check if post/page has gallery?
- how to have the gallery shortcode output one single UL list instead of several DL?
- Automatically add this attribute to the gallery shortcode
- How do i link gallery thumbnails to different url’s using the wp native gallery?
- WordPress gallery ‘post_gallery’ filter doesn’t work with feeds?
- conditional shortcode not working
- Remove width and height attributes from [gallery] output
- Gallery shortcode menu order fix no longer working on WordPress 4.0
- conditional shortcode not working
- Some doubts about gallery shortcode in WordPress
- Should I cache default WordPress gallery shortcode output?
- Numbering Image List in Gallery
- Rewriting WordPress Gallery Shortcode with Bootstrap Carousel
- change wordpress gallery shortcode to slider
- Remove hyperlink on gallery shortcode
- Add custom setting that uses radio button to WP Gallery
- WordPress Gallery shortcode: Display one category ID only
- How to get gallery id inserted to a post?
- Check if post has gallery images/media
- How to Modify WordPress Default Image Gallery Shortcode
- Change WordPress Shortcode added in to post
- Gallery shortcode – change link file image size? (not using default fullsize image)
- add action only if gallery shortcode attribute is equal to?
- Shortcode function executed twice?
- Unable to the get the gallery inserted between shortcodes
- Shortcode callback for add_action(‘wp_footer’)
- Adding shortcode field to edit gallery / Gallery Settings
- How to change the output of gallery shortcode
- How to Retrieve data of Gallery Shortcode and display it above a post
- How to copy [gallery] shortcode between posts using polylang [closed]
- Which file renders the “Edit Gallery” Settings page?
- How to display NextGEN gallery in templates?
- Use full size images in a specific gallery
- JavaScript missing from shortcode content
- How to Enable embedding WordPress default gallery in comments?
- How to add new images to existing shortcode configuration?
- Gallery shortcode is empty but magically creates a gallery
- Can we add a single caption to the gallery shortcode?
- Ajax callback and shortcode functionality
- Automatically add class-attribute to gallery?
- Replace custom gallery shortcode with default gallery shortcode
- WordPress Gallery with ID’s Shortcode not Working
- Remove width and height attributes from [gallery] output
- Changing layout of defaul gallery output to masonry
- What makes a placeholder resizable in Tinymce?
- how to show last 5 images from the one post gallery
- Gallery Shortcode: using size=”full” doesn’t call the actual thumbnail image size
- How to customize a shortcode using the customizer
- Stray closing paragraph tag when using shortcodes
- Customizing gallery shortcode in 3.5
- How can I make all gallery images to open in a new window?
- The result of a shortcode appear BEFORE page content
- Getting the count of a shortcode that is nested
- Get Shortcode Attributes
- Shortcode doesn’t work with classes
- Adding shortcode to the main menu
- Inserting PHP inside do_shortcode
- Display gallery on top before content
- Can a shortcode return its own name?
- Extra paragraph tags in an enclosing shortcode
- Showing a different gallery in a seperate post
- WordPress Vue Js Shortcodes
- Shortcode multiple values
- Documentation for adding a tinyMCE view for visual live preview of custom shortcode?
- Gravity forms – get shortcode attribute from post content
- How to get the $atts of a shortcode
- Getting the count of a shortcode that is nested
- do_shortcode via ajax
- How to list users by custom field?
- How to explode single string IF it’s used in shortcode
- How to dynamically add wordpress shortcodes
- Getting Page Content Using Shortcode
- shortcode with conditional results if logged in
- Can I pass parameters to the add_shortcode() function?
- Turning variable into a value set in shortcode
- how can I change my font color for Shortcode [closed]
- tax query shortcode
- Create a function to display HTML/data based on site admins role?
- AJAX and do_shortcode
- How can I extract a word from page/post URL using shortcodes
- Custom user registration shortcode – redirect header issue
- Shortcode question…. javascript
- Adding shortcode of “Random Content” Plugin in the post after the title
- Create shortcode for metabox gallery
- Variable inside shortcode or shortcode inside shortcode
- From a shortcode I want to pass a value to display a different page
- Shortcode select another dbbase
- Hide password protected dynamic content in templates via shortcode
- Shortcode callback not called
- Shortcode Attribute contains clone of all shortcode attributes
- How to echo an array returned by a function
- Creating custom shortcode
- What is short code for following?
- Created a shortcode, using it twice (but differently) on a page but its just outputting the same one twice
- Access Shortcode in ajax code?
- Automate post creation in wordpress
- How to print [embed] code in wordpress [duplicate]
- How to call shortcode on button click
- How can you alter the name of attributes in a shortcode?