Title: Conditional Loading
Last modified: August 31, 2016

---

# Conditional Loading

 *  Resolved [Celso Bessa](https://wordpress.org/support/users/celsobessa/)
 * (@celsobessa)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/conditional-loading/)
 * [@miguel](https://wordpress.org/support/users/miguel/) Sirvent is there any other
   hook for conditionally loading your plugin. For arguments sake, let’s say, it
   is loaded only if a post belongs to a specific tag or category?
 * Thanks
 * [https://wordpress.org/plugins/wp-embed-facebook/](https://wordpress.org/plugins/wp-embed-facebook/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Miguel Sirvent](https://wordpress.org/support/users/poxtron/)
 * (@poxtron)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/conditional-loading/#post-7005303)
 * Hi.
 * The embeds are added using the wp_embed_register_handler() function so in theory
   you should be able to use wp_embed_unregister_handler() on an action.
 * I have not tested this but it should work
 *     ```
       function wef_conditional() {
         if(in_category(12)){
           wp_embed_unregister_handler('wpembedfb');
         }
       }
   
       add_action( 'wp', 'wef_conditional' );
       ```
   
 * Let me know if this works for you.
 *  Thread Starter [Celso Bessa](https://wordpress.org/support/users/celsobessa/)
 * (@celsobessa)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/conditional-loading/#post-7005418)
 * I will give a try and update the post with the results. Thanks for the response!
 *  Thread Starter [Celso Bessa](https://wordpress.org/support/users/celsobessa/)
 * (@celsobessa)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/conditional-loading/#post-7005482)
 * updating. It didn’t worked.
 * I tried other hooks as well, but still not working. Don’t know if is something
   on my environment or if doing something wrong, but I will update if I have some
   news.
 * Thanks anyway
 *  Plugin Author [Miguel Sirvent](https://wordpress.org/support/users/poxtron/)
 * (@poxtron)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/conditional-loading/#post-7005485)
 * It worked for me on the frontend.
 * Did you purged cache?
 *  Thread Starter [Celso Bessa](https://wordpress.org/support/users/celsobessa/)
 * (@celsobessa)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/conditional-loading/#post-7005487)
 * Yep. I guess is something on my stack. I will check later again!
 * Thanks agaain, Miguel!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Conditional Loading’ is closed to new replies.

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

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [conditional tags](https://wordpress.org/support/topic-tag/conditional-tags/)

 * 5 replies
 * 2 participants
 * Last reply from: [Celso Bessa](https://wordpress.org/support/users/celsobessa/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/conditional-loading/#post-7005487)
 * Status: resolved