The MU forums have moved to WordPress.org

Remove the option to change permalinks (24 posts)

  1. eyespark
    Member
    Posted 17 years ago #

    Hi

    I would like to remove the option to change permalinks in administration. How do I do that?

    And how can I set a default permalink structure?

    Thanks!

  2. eyespark
    Member
    Posted 17 years ago #

    Aaaaah, nevermind. Found my answers. :)

  3. lunabyte
    Member
    Posted 17 years ago #

    Would you mind sharing, in case someone else would like to know in the future? ;)

  4. eyespark
    Member
    Posted 17 years ago #

    Oh, sure! :) In wp-admin folder open menu.php and delete or comment out the lines you don't want (in case of permalinks comment out line 63). Then delete or rename or empty or... file options-permalink.php.

  5. lunabyte
    Member
    Posted 17 years ago #

    Thanks.

    Someone else may find that useful sometime. ;)

  6. zylstra
    Member
    Posted 17 years ago #

    I see that you provided a solution to remove the option of modifying the permalinks structure, but did you mention how to set the default permalink structure?

  7. suleiman
    Member
    Posted 17 years ago #

    yeah, i'd be curious to know that also!

  8. pumpkinslayer
    Member
    Posted 17 years ago #

    The default settings are found in wp-admin/upgrade-schema.php

    Currently line 262 shows the default permalink structure.

    Most of the other default settings can be set from there too.

  9. zylstra
    Member
    Posted 17 years ago #

  10. dsader
    Member
    Posted 17 years ago #

    After removing a file from menu.php, you'll still need to add something such as this near top of any file you don't want prying eyes to execute:

    if( is_site_admin() == false ) {
    die( __('<p>You do not have permission to access this page.</p>') );
    }

  11. qza
    Member
    Posted 17 years ago #

    Please tell me which file do I have to add that line?

    'After removing a file from menu.php, you'll still need to add something such as this near top of any file you don't want prying eyes to execute'

  12. dsader
    Member
    Posted 17 years ago #

    In the context of the post at the top of this thread, /wp-admin/options-permalink.php

  13. qza
    Member
    Posted 17 years ago #

    Thank you. That was quick :)

  14. Akashic
    Member
    Posted 16 years ago #

    In the newest MU version there is no 'upgrade-schema.php' file. Right now looking where to set up default permalinks. Any ideas?

  15. Akashic
    Member
    Posted 16 years ago #

    But is "wp-admin/includes/schema.php" line 185

    add_option('permalink_structure', '/%year%/%monthnum%/%day%/%postname%/');

  16. andrea_r
    Moderator
    Posted 16 years ago #

    It's been removed. On newer code bases, the permalinks are all set up as date-based. there's no option in the backend to change it.

    that line you found above *is* what it is currently set to though.

  17. donncha
    Key Master
    Posted 16 years ago #

    Instead of hacking core files, why not use hooks now?
    Check out wp-admin/includes/mu.php and look for the wpmu_menu() function. That hooks into the "_admin_menu" action to modify the $menu and $submenu array.
    You can do the same by creating a new file in mu-plugins and dropping similar code in there to unset() the options-permalink.php array element.

    On the off chance that someone does find options-permalink.php, and they will, use the "update_option_*" action to reset the permalink related options.
    Or add a mu-plugin that checks if the current REQUEST_URI is /wp-admin/options-permalink.php and if it is die or redirect elsewhere. (that's what I'd do to avoid complications with reseting updated options)

  18. Farms
    Member
    Posted 16 years ago #

    Here's an mu-plugin that does exactly what Donncha is suggesting :)

    http://wpmudevorg.wordpress.com/project/Removes-the-option-to-edit-permalinks

    Enjoy!

  19. Akashic
    Member
    Posted 16 years ago #

    Big thanks for help.

    I had to edit permalinks - by default it's date-title which quite mess up with utf8 character set.

    PS. I just published post, that my hook wasn't working and then saw your post. Ha, thanks!
    This function will also be useful to 'turn off' other redundant options for back end users

  20. donncha
    Key Master
    Posted 16 years ago #

    Farms - that was quick, well done! :)

  21. awarner20
    Member
    Posted 15 years ago #

    Just found this thread and haven't even thought of removing permalinks options for users. Here's an SEO question. Aside from the obvious benefit of not allowing your users to control their own permalinks, wouldn't there be some SEO advantage to having multiple sites, with different permalink structures pointing back to the main site? Instead of many sites, all with the same structure linking back?

    I have no clue, I'm just throwing that out there for conversation;)

  22. Nimwit
    Member
    Posted 14 years ago #

    Read through all the replies the start of this thread is outdated and can't really find what I need so here goes.

    Farms plugin works a treat and I will use that but I also need to set all new blogs to use the following permalink structure mainly for SEO:

    /%category%/%postname%/

    Could someone point me in the direction of which file to modify in MU (I'm using v2.7.1 Beta). Or, even better a similar or modified plugin to Farms one that allows you to specify the structure in the code before uploading...

    N.

  23. andrea_r
    Moderator
    Posted 14 years ago #

  24. Nimwit
    Member
    Posted 14 years ago #

    Thanks andrea.

    N.

About this Topic