Title: cannot render gallery shortcode on 404.php
Last modified: September 9, 2016

---

# cannot render gallery shortcode on 404.php

 *  [bansay](https://wordpress.org/support/users/bansay/)
 * (@bansay)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/cannot-render-gallery-shortcode-on-404-php/)
 * I have a custom post type with an ID of 4, designated for global theme options.
   In the theme options I’ve got a custom field as wysiwyg for user to add the footer
   logos with default WP create gallery functionality. Code snippet WP generates
   for gallery below:
 * $footer_logos =[gallery size="full" ids="8198,8199,8197"]
 * It works great on all templates, except the 404.php
 * I’ve filtered it with apply_filters(‘the_content’, $footer_logos ) — this will
   not display the gallery. If i have other content in the wysiwyg like paragraphs
   or single images, it does display all other wysiwyg content on the 404.php, EXCEPT
   the gallery shortcode. Also tried do_shortcode with the string (this didn’t work,
   and strangely only rendered 2 of the 3 images),
 * I really like the WP default gallery, especially for this instance of footer 
   logos and unforseen # of columns, but for the life of me I can’t get the gallery
   shortcode to render on the 404.php, so i’m considering other options. This feels
   like a WP core bug,
 * I’d love it if WP can fix this in a next version! Or, if someone has knowledge
   as to why the shortcode won’t render on a 404.php, I’d love feedback. Thank you.
    -  This topic was modified 9 years, 8 months ago by [bansay](https://wordpress.org/support/users/bansay/).
    -  This topic was modified 9 years, 8 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).

Viewing 1 replies (of 1 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [9 years, 8 months ago](https://wordpress.org/support/topic/cannot-render-gallery-shortcode-on-404-php/#post-8164760)
 * on your 404.php template, use
 * `<?php echo do_shortcode( '[gallery size="full" ids="8198,8199,8197"]' ); ?>`

Viewing 1 replies (of 1 total)

The topic ‘cannot render gallery shortcode on 404.php’ is closed to new replies.

## Tags

 * [gallery](https://wordpress.org/support/topic-tag/gallery/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/cannot-render-gallery-shortcode-on-404-php/#post-8164760)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
