1

Hi I am trying to remove date and comments from assignment listing from learndash plugin currently I have tried below code but it was not working. Any other suggestions will be very grateful

apply_filters( 'learndash-assignment-list-columns',
function( $columns ) {
  // Unset columns
  unset($columns['date']);
  unset($columns['comments']);

  // Always return $columns.
  return $columns;
});
Jake
  • 9
  • 2

1 Answers1

0

apply_filters is wrong in your code. apply_filters is used to provide filters for something. you need to use add_filter since you have to add your function in learndash-assignment-list-columns filter.

So your code should be:

add_filter(
    'learndash-assignment-list-columns',
    function( $columns ) {
        // Unset columns.
        unset( $columns['date'] );
        unset( $columns['comments'] );

        // Always return $columns.
        return $columns;
    }
);

Learndash already have examples for this filter https://developers.learndash.com/hook/learndash-assignment-list-columns/#examples

Vijay Hardaha
  • 2,411
  • 1
  • 7
  • 16