Support » Fixing WordPress » WordPress functions outside main theme

  • iperez_genius


    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.

Viewing 1 replies (of 1 total)
  • Drew Jaynes


    WordPress Core Developer

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘WordPress functions outside main theme’ is closed to new replies.