Last active
June 23, 2017 09:08
-
-
Save robertdevore/97fb0f034c320738ebf8dab302953376 to your computer and use it in GitHub Desktop.
Flush rewrite rules on plugin activation to stop your CPT from returning 404 errors
This file contains hidden or 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 | |
function activate_acme_cpt() { | |
cpt_function(); | |
/** CPT taxonomy functions can be added too */ | |
cpt_tax_function(); | |
global $wp_rewrite; | |
$wp_rewrite->init(); | |
$wp_rewrite->flush_rules(); | |
} | |
// Registers the plugin activation hook. | |
register_activation_hook( __FILE__, 'activate_acme_cpt' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment