Title: Problem: Shortcode parser only loaded on frontend
Last modified: April 21, 2022

---

# Problem: Shortcode parser only loaded on frontend

 *  Resolved [João Saraiva](https://wordpress.org/support/users/joaosaraiva/)
 * (@joaosaraiva)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/problem-shortcode-parser-only-loaded-on-frontend/)
 * Hello.
    While analyzing why the dflip shortcode exhibited problems when used 
   in conjunction with our plugin (Paperview Publisher), I noticed that the shortcode
   parser is only loaded when the request is in a frontend context; when in a backend
   context, the parser is not loaded. This, in turn, makes “apply_filters(‘the_content’,
   <content to filter>)” not return the content with the shortcode replaced by the
   corresponding HTML when it is invoked in the backend (in this specific case, 
   in a plugin that runs in wp-admin, when there is new post content).
 * The problematic snippet is in 3d-flipbook-dflip-lite.php, line 554:
 *     ```
       // Load admin only components.
        if ( is_admin() && !wp_doing_ajax() ) {
          $this->init_admin();
        } else { // Load frontend only components.
          $this->init_front();
        }
       ```
   
 * My suggestion is to include the unconditional loading of the shortcode parser,
   like this:
 *     ```
       //include the shortcode parser
        include_once dirname( __FILE__ ) . "/inc/shortcode.php";
   
        // Load admin only components.
        if ( is_admin() && !wp_doing_ajax() ) {
          $this->init_admin();
        } else { // Load frontend only components.
          $this->init_front();
        }
       ```
   
 * (The include_once is extracted from init_front. It can be removed from the function
   afterward, or just left there, as the code won’t be loaded again anyway.)
 * I understand that you try to load only the necessary components, and that is 
   fine. However, IMHO, loading the shortcode parser is not a particularly cumbersome
   or heavy operation (especially if PHP has a caching mechanism configured), but
   not loading it may lead to the ‘the_content’ filter not returning the expected
   results when run in the wp-admin context.
 * Thank you for your time.
 * Best regards,
    João Saraiva (Paperview Systems)

The topic ‘Problem: Shortcode parser only loaded on frontend’ is closed to new replies.

 * ![](https://ps.w.org/3d-flipbook-dflip-lite/assets/icon-128x128.gif?rev=3175518)
 * [DearFlip - PDF Flipbook, 3D Flipbook, PDF embed, PDF viewer](https://wordpress.org/plugins/3d-flipbook-dflip-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/3d-flipbook-dflip-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/3d-flipbook-dflip-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/3d-flipbook-dflip-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/3d-flipbook-dflip-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/3d-flipbook-dflip-lite/reviews/)

## Tags

 * [admin](https://wordpress.org/support/topic-tag/admin/)
 * [apply_filters()](https://wordpress.org/support/topic-tag/apply_filters/)
 * [frontend](https://wordpress.org/support/topic-tag/frontend/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [the_content](https://wordpress.org/support/topic-tag/the_content/)

 * 0 replies
 * 1 participant
 * Last reply from: [João Saraiva](https://wordpress.org/support/users/joaosaraiva/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/problem-shortcode-parser-only-loaded-on-frontend/)
 * Status: resolved