I am new to wordpress and cant figure out a way to grab data from the database.
I have set up a new php file.
I am using code from theme pages to get it the same way on the new file.php
<?php global $post; $id=$_GET['id']; $dt_fields = get_post_meta($post->ID, 'fields', true); print_r($dt_fields); ?>
so I am getting the id from the url and trying to retrieve details from the db I know I need to include some things to get this working but I really cant find what.
The error I get
PHP Fatal error: Call to undefined function get_post_meta()
Read more here: I’m trying to get data from database from php file