Title: Simple Custom Post Order Hook
Last modified: October 27, 2020

---

# Simple Custom Post Order Hook

 *  Resolved [marcorroma](https://wordpress.org/support/users/marcorroma/)
 * (@marcorroma)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/simple-custom-post-order-hook/)
 * Hi, I have to create a “clear cache” function for some pages (no categories),
   when the order of posts is changed.
    What hook does your plugin use when changing
   the order of posts? Thanks for support!

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

 *  [visi19](https://wordpress.org/support/users/visi19/)
 * (@visi19)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/simple-custom-post-order-hook/#post-13585549)
 * Hello [@marcorroma](https://wordpress.org/support/users/marcorroma/)
 * Thank you for reaching us !
 * Can you send us more details about your problem? Much more explicit please, I
   did not understand exactly what you need or what you want to do? Can you give
   us a concrete example?
 * Please let me know if you have some more questions !
 * Have a nice day ! 🙂
 * Warmly,
    Marian
 *  Thread Starter [marcorroma](https://wordpress.org/support/users/marcorroma/)
 * (@marcorroma)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/simple-custom-post-order-hook/#post-13585572)
 * Hi, I’m working on a function to clear (on WP Rocket) the cache of some pages(
   which contain previews of posts). I would like to insert an “add_action” when
   your plugin function is used to sort posts.
 *  [visi19](https://wordpress.org/support/users/visi19/)
 * (@visi19)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/simple-custom-post-order-hook/#post-13590918)
 * Hello [@marcorroma](https://wordpress.org/support/users/marcorroma/)
 * `add_action('pre_get_posts', array($this, 'scporder_pre_get_posts'));`
    the hook
   is pre_get_posts and in the plugin you can find it here -> [https://github.com/ColorlibHQ/simple-custom-post-order/blob/master/simple-custom-post-order.php#L62](https://github.com/ColorlibHQ/simple-custom-post-order/blob/master/simple-custom-post-order.php#L62)
   I hope I could help you !
 * Have a nice day ! 🙂
 * All the best,
    Marian
 *  Thread Starter [marcorroma](https://wordpress.org/support/users/marcorroma/)
 * (@marcorroma)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/simple-custom-post-order-hook/#post-13933659)
 * Hi, I created this function but it doesn’t work.
    I am convinced that the actions
   of Litespeed cache plugin are correct. I think something is missing to link the
   purge cache to the action of “Simple Custom Post Order”
 *     ```
        add_action( 'scporder_pre_get_posts', 'lscwp_purge_order' );
        function lscwp_purge_order() {
        if ( defined( 'LSCWP_V' ) ) {
        do_action('litespeed_purge_url', 'https://www.mywebsite.com/myurl/');
        } } 
       ```
   
 * PS. I have hidden the url of the page I want to cache clear
 *  [Miha](https://wordpress.org/support/users/mplusb/)
 * (@mplusb)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/simple-custom-post-order-hook/#post-13937590)
 * Hi [@marcorroma](https://wordpress.org/support/users/marcorroma/),
 * scporder_pre_get_posts is the function hooked on the “pre_get_posts” action. 
   You can use this hook: scp_update_menu_order which you can use after the posts
   are ordered. Or scp_update_menu_order_tags to use after the taxonomies are ordered.
 * Warmly,
    Mihaela
 *  Thread Starter [marcorroma](https://wordpress.org/support/users/marcorroma/)
 * (@marcorroma)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/simple-custom-post-order-hook/#post-13937857)
 * THANKS.
    With scp_update_menu_order work it! Thanks!
 *  [Miha](https://wordpress.org/support/users/mplusb/)
 * (@mplusb)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/simple-custom-post-order-hook/#post-13942619)
 * Happy to hear that! You’re most welcome!
 *  [vitoralmeida](https://wordpress.org/support/users/vitoralmeida/)
 * (@vitoralmeida)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/simple-custom-post-order-hook/#post-14207468)
 * Hello !
 * Its possible to send more information at do_action(‘scp_update_menu_order’) ?
 * Example:
    – screen (get_current_screen used in after_edit_post hook for example.–
   post type
 * Without any information about posts i needed to get the first ID in order param
   to get_post and them discover the post_type in case.

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

The topic ‘Simple Custom Post Order Hook’ is closed to new replies.

 * ![](https://ps.w.org/simple-custom-post-order/assets/icon-256x256.jpg?rev=2969435)
 * [Simple Custom Post Order](https://wordpress.org/plugins/simple-custom-post-order/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-custom-post-order/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-custom-post-order/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-custom-post-order/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-custom-post-order/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-custom-post-order/reviews/)

 * 8 replies
 * 4 participants
 * Last reply from: [vitoralmeida](https://wordpress.org/support/users/vitoralmeida/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/simple-custom-post-order-hook/#post-14207468)
 * Status: resolved