Shortcode to generate and save password in a file
Per the comment under the OP’s question, below is the solution by using a return instead of an echo: add_shortcode( ‘phptest’, ‘custom_shortcode_phptest’ ); function custom_shortcode_phptest() { // Add Shortcode function generatePassword( $length = 6 ) { $characters=”0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ”; $charactersLength = strlen( $characters ); $pass=””; for ( $i = 0; $i < $length; $i++ ) { $pass … Read more