LearnPress 版本4.x,如何去除一个钩子

LearnPress version 4.x, how to remove a hook

我正在开发一个主题,这就是为什么需要删除这两个挂钩。如何删除它们?

add_action(
    'learn-press/before-courses-loop-item',
    LP()->template( 'course' )->text( '<div class="course-wrap-thumbnail">', 'course-wrap-thumbnail-open' ),
    1
);
add_action(
    'learn-press/before-courses-loop-item',
    LP()->template( 'course' )->callback( 'loop/course/badge-featured' ),
    5
);

使用 remove_action 挂钩删除操作

remove_action( 'learn-press/before-courses-loop-item' , 'loop/course/badge-featured', 28);

或者...

remove_action( 'learn-press/before-courses-loop-item', LP()->template( 'course' )->callback( 'loop/course/badge-featured' ), 10 );

折腾了一段时间后,我检查了LearnPress插件的核心文件,在注释代码中找到了解决方案。

    'learn-press/before-courses-loop-item',
    LP()->template( 'course' )->text( '<div class="course-wrap-thumbnail">', 'course-wrap-thumbnail-open' ),
    1
);

LP()->template( 'course' )->remove( 'learn-press/before-courses-loop-item', array( '<div class="course-wrap-thumbnail">', 'course-wrap-thumbnail-open' ), 10 );

add_action(
    'learn-press/before-courses-loop-item',
    LP()->template( 'course' )->callback( 'loop/course/badge-featured' ),
    5
);

LP()->template( 'course' )->remove_callback( 'learn-press/before-courses-loop-item', 'loop/course/badge-featured', 5 );```

Each hook needs to remove by this way. It is working fine with my theme now. Thanks all of you who gave answers here.