I am using an external plugin (not my own CPT) to manage events on a site where the blog permalinks structure is /news/%category%/%postname%/

Normally for CPTs I could set the prepend with front to FALSE when creating the CPT but in this case I don't know how since the plugin controls the definition.

The developer sent me the snippet below but it does not work in either correctly changing the slug (actaully breaks event permalinks) or setting with_front to false:

//    EVENTON Calendar SLUG correction

add_filter('eventon_register_post_type_ajde_events', 'fix_event_slug', 10, 1); 
function fix_event_slug($array){     

$newar = $array; 
$newar['rewrite']= array( 'with_front'=>false, 'slug'=>'events' ); //
// print_r($newar); return $newar; // test

Any help much appreciated.

  • you probably need to return $newar Commented Jul 31, 2014 at 4:37
  • Ah, I feel like a dolt... never noticed the return statement, as it was as the end of the test line! Will check now! Thanks. Commented Jul 31, 2014 at 23:56

1 Answer 1


As Mark explained, you will need to return $newvar. That should work. Also, please reset the permalink once. (I mean, go to Permalinks section in dashboard and click 'Save changes' button without making any changes. It will flush rewrite rules and build them again.)

If it still does not work, then I think below snippet may help. Check if that works. I found it here

add_filter('eventon_register_post_type_ajde_events', 'fix_event_slug', 10, 1);

function fix_event_slug($arr){
$new_ar = array('rewrite' => array('with_front'=>false, 'slug'=>'events'));
return array_merge($arr, $new_ar);

After adding above section, please reset the permalinks.

  • OK, I tried both options, and nothing happens... permalinks stay the same as before and reside under "news/" Commented Aug 2, 2014 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.