WordPress.org

Ready to get started?Download WordPress

Ideas

current_user_cant function

  1. Metin Saylan
    Member

    This is just a specific example. We can write simple shortcode functions to make code more readable. This will make code better.

    function current_user_cant($capability){ return ! current_user_can($capability); }

    Posted: 3 years ago #
  2. ucfknight10
    Member

    12345

    while it would make code more easily readable, i think it would also bloat the code. i for one love wordpress cause it is hugely expandable, but maintains a fast load time. adding this other functions simply for sake of readability seems unnecessary to me. even a novice programmer should notice the exclamation mark and easily understand that it's equivalent to i.e. current_user_cant.

    Posted: 3 years ago #
  3. jimmyink
    Member

    12345

    Why not use
    if(!current_user_can($capability))

    I agree with ucfknight10 on this.

    Posted: 3 years ago #
  4. mrmist
    Moderator

    Indeed.

    Posted: 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    3 Votes
  • Status

    Sorry, not right now