How can I convert functions like the_permalink() into strings like $permalink?
1 Answer
Use get_permalink()
function which returns a value instead of printing it.
Example -
$permalink = get_permalink($id); //$id if using outside loop
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityUse get_permalink()
function which returns a value instead of printing it.
Example -
$permalink = get_permalink($id); //$id if using outside loop