WordPress functions outside main theme (2 posts)

  1. iperez_genius
    Posted 3 years ago #

    In my theme folder i have a sub folder.
    Inside that folder is a php file that i want to access get_post_meta for example.

    when i try and access the functions i get this error

    Fatal error: Call to undefined function add_post_meta() in /home/theme.../myfolder/voting.php on line 23

    what do i need to include in the voting.php to allow this php file to access the wordpress functions.

  2. Drew Jaynes
    Docs Czar
    Posted 3 years ago #

    Hi iperez_genius,

    Generally, you would need to include that file voting.php inside a file that resides in the theme's root. There are some exceptions where theme files are accessible in a sub-directory, but this doesn't appear to be one of them.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.