WordPress.org

Ready to get started?Download WordPress

Forums

post_gallery filter not passing arguments of gallery shortcode (1 post)

  1. Kaleb.G
    Member
    Posted 5 years ago #

    I have a plugin like so:

    <?php
    /* Author info */
    
    add_filter('post_gallery', 'kg_gallery_shortcode');
    
    function kg_gallery_shortcode($attr) {
    	global $post;
    
    	extract(shortcode_atts(array(
    		'id' => $post->ID,
    		'ex' => ''
    	), $attr));
    
    /* ... */
    }
    ?>

    Well the plugin works fine doing everything I need to do with the default [gallery] tag, but it seems like it completely ignores any attributes, e.g. [gallery ex="2"] or even [gallery id="1"].

    I tried changing the filter addition to

    add_filter('post_gallery', 'kg_gallery_shortcode', 1, 1);

    But that changed nothing. Why isn't anything coming through on the argument array?

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic