Timeline for Is it possible to restrict access to specific pages in the admin area based on the page slug?
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 16, 2017 at 12:14 | vote | accept | RevelationTravis | ||
Apr 14, 2017 at 6:43 | answer | added | CK MacLeod | timeline score: 1 | |
Apr 14, 2017 at 2:08 | comment | added | RevelationTravis | No, I know what the ID is. What I would like is a way of doing what the code in my previous comment does, but using the slug instead of the ID. Since ID's change from website to website, but slugs do not (assuming you use the same page titles - which I would - see original question), having a code snippet that uses page slugs (and not ID's) would be more useful for copying and pasting from one site to another. | |
Apr 12, 2017 at 22:01 | comment | added | CK MacLeod | So are you saying you need an example of deriving and using the ID, or that you're all set? | |
Apr 12, 2017 at 21:56 | comment | added | RevelationTravis | Thanks again for taking the time to respond! There's a number of examples of how to do this using the ID. A simple and straight forward approach seems to be, from my limited knowledge, found here: wordpress.stackexchange.com/questions/13528/… From my testing, with a little modification, this works nicely. | |
Apr 11, 2017 at 21:07 | comment | added | CK MacLeod | Sorry - I misread your question (or didn't read it closely enough). I think one good method would be to derive the id using get_page_by_path(), if that doesn't work for you for some reason, just provide the code you're starting with, and maybe I (or someone!) can write a "real" answer for you. | |
Apr 11, 2017 at 19:22 | comment | added | RevelationTravis | Maybe I'm missing something, but I don't see how the answer in your link applies to my question. I'm trying to prevent certain pages from appearing in the list of pages (based on the page slug, not the ID), unless you're an administrator role. Perhaps I need to add clarification to my question? This is closer to what I'm trying to do: wordpress.stackexchange.com/questions/13528/… But that example uses ID's - not the page slug. Also, I would say "!is_admin()" instead of "is_admin()", but you probably get the idea. | |
Apr 10, 2017 at 17:05 | comment | added | CK MacLeod | This was already answered here: wordpress.stackexchange.com/questions/14964/… - note that it defines user roles by capability (current_user_can). If there's something specific you don't get about the answer, be more specific, and someone can probably provide a full-fledged "Answer." | |
Apr 10, 2017 at 17:05 | review | First posts | |||
Apr 10, 2017 at 19:18 | |||||
Apr 10, 2017 at 17:00 | history | asked | RevelationTravis | CC BY-SA 3.0 |