From f5436d446cc0042be5c2483978cf666040643b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Bj=C3=B6rk?= Date: Sat, 2 Jan 2021 16:48:56 +0100 Subject: [PATCH] If there was two blog entries with the same permalink but different dates, `find_post` always returned the latest one and ignored year/month. Fixed by checking that `$year` is actually set to NULL, which is the case if you use the post/title permalink type. --- system/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/includes/functions.php b/system/includes/functions.php index 665c683..f2c3604 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -386,7 +386,7 @@ function find_post($year, $month, $name) foreach ($posts as $index => $v) { $arr = explode('_', $v['basename']); - if (strpos($arr[0], "$year-$month") !== false && strtolower($arr[2]) === strtolower($name . '.md') || strtolower($arr[2]) === strtolower($name . '.md')) { + if ((strpos($arr[0], "$year-$month") !== false && strtolower($arr[2]) === strtolower($name . '.md')) || ($year === NULL && strtolower($arr[2]) === strtolower($name . '.md'))) { // Use the get_posts method to return // a properly parsed object