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
Use get_permalink() function which returns a value instead of printing it.
Example -
$permalink = get_permalink($id); //$id if using outside loop