I am creating a wordpress shortcode [ADD_POT ID=’X’], which is able to get the ID value, in purpose to execute a function.

Unfortunately, there is an error within the third line of my code. Someone can give me a hand please ? Thank you.

function ADD_POT($atts) {
	$ID = shortcode_atts(array( 'ID' => TRUE), $atts) ;
	$pot_ID = $ID['ID'] ;
	include dirname(__FILE__) . '/../../../wp-config.php' ;
	include dirname(__FILE__) . '/../../../wp-content/plugins/Study-Tool/core/login.php' ;
	$pot_selection = "SELECT question_ID FROM questions WHERE pot_ID='$pot_ID'" ;
	$pot_result = mysqli_query ($connect,$pot_selection) ;
	foreach ($pot_result as $pot_ID) {
	$question_ID = $pot_ID['question_ID'] ;
	ADD_Q($question_ID) ;
}
}

Read more here: Shortcode wordpress with parameter


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: