Changing slug is failing

Home Forums Legacy Support Support queries Setup issues Changing slug is failing

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1735
    portalZINE
    Spectator
    add_action('plugins_loaded','wplms_define_constants',5);
    function wplms_define_constants(){ if ( ! defined( 'BP_COURSE_RESULTS_SLUG' ) ) define( 'BP_COURSE_RESULTS_SLUG', 'lesson-results' ); if ( ! defined( 'BP_COURSE_STATS_SLUG ' ) ) define( 'BP_COURSE_STATS_SLUG', 'lesson-stats' ); if ( ! defined( 'WPLMS_COURSE_SLUG' ) ) define( 'WPLMS_COURSE_SLUG', 'lessons' ); if ( ! defined( 'BP_COURSE_SLUG' ) ) define( 'BP_COURSE_SLUG', 'lessons' ); if ( ! defined( 'WPLMS_COURSE_CATEGORY_SLUG' ) ) define( 'WPLMS_COURSE_CATEGORY_SLUG', 'lesson-cat' ); } These 2 fail: if ( ! defined( 'WPLMS_COURSE_SLUG' ) ) define( 'WPLMS_COURSE_SLUG', 'lesson' ); if ( ! defined( 'BP_COURSE_SLUG' ) ) define( 'BP_COURSE_SLUG', 'lesson' ); Permalinks have been cleared multiple times and work, as the other defines stick Regards Alex
    #1738
    portalZINE
    Spectator
    Had to move the defines to the wp-config : # SLUGS if ( ! defined( 'WPLMS_COURSE_SLUG' ) ) define( 'WPLMS_COURSE_SLUG', 'lesson' ); if ( ! defined( 'BP_COURSE_SLUG' ) ) define( 'BP_COURSE_SLUG', 'lesson' ); if ( ! defined( 'BP_COURSE_INSTRUCTOR_SLUG' ) ) define( 'BP_COURSE_INSTRUCTOR_SLUG', 'teacher-lessons'); Not ideal, but works for now :) Regards Alex
    #1979
    Anshuman Sahu
    Keymaster
    Yes you can paste the code in wp-config.php file as well as this file is not gets rewritten on updates . The code works in this way  : It defines the constants if not defined .If the constants are defined before your custom code then it custom code will not define the new constants . It means that your "custom slugs" code needs to run before the actual code runs . Also we are adding the option to give custom slugs feature from the wp-admin itself in next update .
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Changing slug is failing’ is closed to new replies.