• Resolved AK Ted

    (@akted)


    What is the current best practice for limiting the scope of a plugin you’re creating? For example, say you have a plugin that only does stuff backend (admin). One way I thought of was

    <?php
    // Plugin Name:...
    if (is_admin()) include('the-rest.php');
    ?>

    Is there a better way?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator t-p

    (@t-p)

    Thread Starter AK Ted

    (@akted)

    @t-p: I’m not sure how that’s an answer to my question. Searching that page, I don’t find any occurrences of these words: best, practice, limit, or scope. Minimize is listed, but only in re: to db’s. I didn’t see anything there about what I asked.

    It’s almost as if I asked “What internal temp should I cook a turkey to?” and was given a cookbook, hoping that the answer might be in there.

    Moderator t-p

    (@t-p)

    The linked is a WP codex article about creating plugins. If you did not find a specific info i it, just keep searching the forums. Or someone more expert in that may chime in.

    Happy Holidays!

    Thread Starter AK Ted

    (@akted)

    Found a better way

    <?php
    // Plugin Name:...
    if ( ! is_admin() ) return;
    
    // rest of code goes here
    ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Minimizing Plugin Impact’ is closed to new replies.