1

I'm trying to get the user meta in a file calles "print.php" in my child-theme folder:

define( 'WP_USE_THEMES', true ); 
$userid = $_GET['id'];
//$all_meta = get_user_meta( $userid );

When I call "get_user_meta()" i get an Error 500.

I already tried with

define('WP_USE_THEMES', false);
require('./wp-blog-header.php');

and

define('WP_USE_THEMES', false);
require('./wp-load.php');

What am I doing wrong and how can I resolve it?

Also tried already to put a function in my functions.php and call this function. No luck.

I hope you can help me.

Thanks and best regards,

Niko

1 Answer 1

0

You must include the wp_head() Function on top of your index.php / function.php. So that you can use WordPress Funktions. See the documentation here

https://developer.wordpress.org/reference/functions/wp_head/

1
  • Thank you for your answer. It is alredy resolved. I tried to call my php file outside the wordpress loop which was apparently not possible.
    – Niko
    Commented Oct 3, 2020 at 9:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.