Hi @helentacang,
This tag is not included neither in Permalink Manager nor WordPress core codebase.
Actually, I have found that this tag (with a custom code snippet and detailed instructions) is mentioned only in this article:
https://wordpress.stackexchange.com/a/330933/38240
Unfortunately, to remove the trailing zeros with my plugin you will need to use code snippet:
/**
* Use single-digit month number in permastructures
* Use %monthnum2% or %daynum2% in "Permastructure" settings
*/
function pm_date_tags($default_uri, $post) {
if(empty($post->post_type)) {
return $default_uri;
}
if(strpos($default_uri, '%monthnum2%') !== false) {
$monthnum = date('n', strtotime($post->post_date));
$default_uri = str_replace('%monthnum2%', $monthnum, $default_uri);
}
if(strpos($default_uri, '%daynum2%') !== false) {
$daynum = date('j', strtotime($post->post_date));
$default_uri = str_replace('%daynum2%', $daynum, $default_uri);
}
return $default_uri;
}
add_filter('permalink_manager_filter_permastructure', 'pm_date_tags', 5, 2);
Please simply paste it to functions.php in your child theme directory. Then you will be able to use both %monthnum2% and %daynum2% in Permastructure settings.
Best regards,
Maciej
Thanks, Maciej!!
I tried it out and it’s working 🙂