0

I am creating 2 different plugins for LearnDash ( One for Lesson , another for Topic ) in WordPress. Here I have a requirement to use one LearnDash hook (ld_lesson_access_from) in both the plugins.

When I activate any one plugin , this hook works fine. But when Both the plugins are activated , then hook with highest priority is running.

On course page , where Topics and Lessons are listed , I have requirement to activate both the plugins, .

//Plugin 1
add_filter( 'ld_lesson_access_from', array( __CLASS__, 'filter__ld_lesson_access_from_1' ), 999999, 3 );
public static function filter__ld_lesson_access_from_1( $access_from, $lesson_id, $user_id ) {
    // code
}

//Plugin 2
add_filter( 'ld_lesson_access_from', array( __CLASS__, 'filter__ld_lesson_access_from_2' ), 99999, 3 );
public static function filter__ld_lesson_access_from_2( $access_from, $topic_id, $user_id ) {
    // code
}

I want that both the hook should run. How do I do this ?

Or

Can we have the same filter for Topic ?

Parthavi Patel
  • 739
  • 11
  • 28

1 Answers1

-1

Make the priority of the second hook higher than the first one.

B.AL
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 04 '23 at 13:33