How to create a php variable using WordPress the_title() function
Indeed, the the_title function echoes the title, unless you set the third parameter to false (default true). So you start with this; $title = the_title (”,”,false); Now, $title may contain all kinds of characters that cannot be used in PHP variable names, so we need some sanitization: $title = preg_replace(‘/[^A-Za-z0-9\_]/’, ”, $title); // Removes special … Read more