diff --git a/includes/admin/metaboxes/views/shortcode-hint.php b/includes/admin/metaboxes/views/shortcode-hint.php index 38de55aff7..309e82b6ee 100644 --- a/includes/admin/metaboxes/views/shortcode-hint.php +++ b/includes/admin/metaboxes/views/shortcode-hint.php @@ -6,12 +6,21 @@ */ global $post; + +$view = \GV\View::from_post( $post ); +$secret = $view->get_validation_secret(); +$atts = [ sprintf( "id='%d'", $post->ID ) ]; +if ( $secret ) { + $atts[] = sprintf( "secret='%s'", $secret ); +} + +$shortcode = sprintf( '[gravityview %s]', implode( ' ', $atts ) ); ?>