mhmdshaheen mhmdshaheen - 3 months ago 15
PHP Question

var_dump $_GET return null or not worked in wordpress

i'm have a problem with GET request in wordpress
when i'm

$post_ide = $_GET['post-id'] ;


var_dump($_GET['post-id']);


when i'm go to the linke example.com/?post-id=300 i'm have this linke examole.com without GET post-id and var_dump return null

can anyone help me ??
thank you

Answer

Instead of the hyphen in the variable name use example.com/?post_id=300 and

$post_id = $_GET['post_id'];
var_dump( $post_id );
Comments