Title: Recursion during exporting PDF (setLocale())
Last modified: August 30, 2016

---

# Recursion during exporting PDF (setLocale())

 *  Resolved [bseeger](https://wordpress.org/support/users/bseeger/)
 * (@bseeger)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/recursion-during-exporting-pdf-setlocale/)
 * I’m using Pressbooks version 2.5
 * I’m seeing recursion during exporting in PDF format:
 * In plugins/pressbooks/hook.php:
 *     ```
       if ( \PressBooks\Book::isBook() && \PressBooks\l10n\use_book_locale() ) {
               add_filter( 'locale', '\PressBooks\Export\Export::setLocale' );
       } else {
               add_filter( 'locale', '\PressBooks\L10n\set_locale' );
       }
       ```
   
 * My code executes the ‘if’ portion above, adding the \PressBooks\Export\Export::
   setLocale to the filters.
 * Then later, when the filter is applied, the export’s setLocale() calls into getBookInformation()(/
   plugins/pressbooks/includes/modules/export/class-pb-export() line 713), which
   then again, applies filters:
 * plugins/pressbooks/includes/class-pb-book.php line 104:
    `$val = apply_filters('
   the_content', $val );`
 * And the recursion begins…
 * My work around is to skip the ‘if’ clause above and just use what’s in the ‘else’
   part of. Is there something in our setup that’s causing this recursion?
 * [https://wordpress.org/plugins/pressbooks/](https://wordpress.org/plugins/pressbooks/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Ned Zimmerman](https://wordpress.org/support/users/greatislander/)
 * (@greatislander)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/recursion-during-exporting-pdf-setlocale/#post-6324958)
 * Thanks again for reporting this issue!

Viewing 1 replies (of 1 total)

The topic ‘Recursion during exporting PDF (setLocale())’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/pressbooks.svg)
 * [Pressbooks](https://wordpress.org/plugins/pressbooks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pressbooks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pressbooks/)
 * [Active Topics](https://wordpress.org/support/plugin/pressbooks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pressbooks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pressbooks/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Ned Zimmerman](https://wordpress.org/support/users/greatislander/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/recursion-during-exporting-pdf-setlocale/#post-6324958)
 * Status: resolved