Home / Archive / MemberPress: Change Courses Listing Page Link
Duplicate Snippet

Embed Snippet on Your Site

MemberPress: Change Courses Listing Page Link

This code snippet will replace the URL for built-in links to the default MemberPress Course Listings page with a custom link.

The default slug courses should be replaced with the slug of the page or post that should be linked instead, on the following link of the code:

$link = home_url() . '/courses/';

Code Preview
php
<?php
add_filter( 'post_type_archive_link', function ( $link, $post_type ) {
  if ( $post_type == 'mpcs-course' ) {
    $link = home_url() . '/courses/'; //replace the word courses with the custom page or post slug
  }
  return $link;
}, 10, 2 );

Comments

Add a Comment