WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Minimizing Plugin Impact (5 posts)

  1. AK Ted
    Member
    Posted 2 years ago #

    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?

  2. Tara
    Member
    Posted 2 years ago #

  3. AK Ted
    Member
    Posted 2 years ago #

    @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.

  4. Tara
    Member
    Posted 2 years ago #

    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!

  5. AK Ted
    Member
    Posted 2 years ago #

    Found a better way

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.