Ready to get started?Download WordPress


WordPress functions in plugin files (4 posts)

  1. Spretor
    Posted 1 month ago #

    Good day!
    I have the following problem: in the main file plugin 'plugin-name.php' I can use WordPress functions (eg get_option ()), and can't do it in additional files, there is an error 'call to undefined function'.
    How to act properly in this case?

  2. catacaustic
    Posted 1 month ago #

    How are you calling the other files? Are you just adding links to the files, or have you got them set up properly using admin menus?

  3. Spretor
    Posted 1 month ago #

    I'm just include this files with 'require_once' in my main plugin file.

  4. catacaustic
    Posted 1 month ago #

    So how are you getting to those pages? Through a menu or have you created your own links?

    I think you should read up on the link that I posted before. That will tell you the right way to add functions into the admin area, and I think that's what you haven't done yet.

    Apart from that, copy-and-paste the exact error message that you're getting so we can see exactly what is going on.


You must log in to post.

About this Topic