看起来可以使用占位符标记,下面是使用_custom_link
的值http://somelink.com/?ref=%%title%%
.
<?php
// must be within the Loop
$ref_slug = strtoupper(sanitize_title_with_dashes(get_the_title()));
$regex = \'(\\%\\%title\\%\\%)\';
$ref_link = ( get_option(\'_custom_link\') ) ? preg_replace( $regex, $ref_slug, get_option(\'_custom_link\')) : null;
echo $ref_link;
?>