Last active
March 14, 2017 14:30
-
-
Save pgk/581262fe4b3d117ee53d1c9c5a33a671 to your computer and use it in GitHub Desktop.
sensei_cpt_course_do_not_use_with_front.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Enable Sensei courses to display on /course | |
* Plugin URI: | |
* Description: Enable Sensei courses to display on /course/<course_name> instead of /blog/course/<course_name>, | |
* Author: WooThemes | |
* Author URI: https://woocommerce.com | |
* Requires at least: 4.7.3 | |
* Tested up to: 4.7.3 | |
* Domain path: /lang/ | |
* | |
* @package WordPress | |
* @author WooThemes | |
* @since 1.0.0 | |
*/ | |
/** | |
* Enable Sensei courses to display on /course/<course_name> instead of /blog/course/<course_name>, | |
* assuming a permalink structure like /blog/%year%/%monthnum%/%day%/%postname%/ is set up for the site's posts | |
* see https://codex.wordpress.org/Function_Reference/register_post_type | |
* | |
* Usage: | |
* 1. add the folder containing just this snippet as a plugin. Activate. | |
* 2. Deactivate/Reactivate Sensei | |
*/ | |
function sensei_cpt_course_do_not_use_with_front( $args ) { | |
$args['rewrite']['with_front'] = false; | |
return $args; | |
} | |
add_filter( 'sensei_register_post_type_course', 'sensei_cpt_course_do_not_use_with_front' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment