• Resolved marcorroma

    (@marcorroma)


    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)
  • Hello @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

    (@marcorroma)

    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.

    Hello @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
    I hope I could help you !

    Have a nice day ! ??

    All the best,
    Marian

    Thread Starter marcorroma

    (@marcorroma)

    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

    Hi @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

    (@marcorroma)

    THANKS.
    With scp_update_menu_order work it!
    Thanks!

    Happy to hear that! You’re most welcome!

    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.