I need to add 'function' and 'add_action' in a single post page.
I created the following code in functions.php, then added the shortcode [test-query] in the single post page.
But, it even doesn't display the value of the echo.
Would you please let me know how to add 'function' and 'add_action' in the single post page?
Code I tried:
function test_query(){
function update_post_b( $post_id, $post, $update ){
if .....
$posts = get_posts(array( ....
echo .....
add_action( 'save_post_infosubmission', 'update_post_b', 10, 3 );
}
add_shortcode( 'test-query', 'test_query' );
Thank you.