I using a plugin that it makes posts and etc date to Persian Date but the problem is I just want to convert date in front not admin panel or etc. I found that part make this action:

add_filter('date_i18n', 'ztjalali_ch_date_i18n', 111, 4);

It using add_filter to do this on date_i18n function, can I change it somehow that convert only date in blog post in front. I'm not a wordpress expert and don't know too much about date_i18n, but I think it refer to all post date in everywhere, so can I change the code to only convert in front?

something like:

add_filter('post_date', 'ztjalali_ch_date_i18n', 111, 4);

I tried above but no success.


You need to add an additional filter on the frontend. Very basically it would look like this:

Frontend (eg. single.php):

echo apply_filters( 'my_custom_persian_filter', $post_date );

Backend (eg. functions.php)

function persian_date_function( $date ) {
    $date = $converted_to_persian; // there you convert date to persian
    return $date;
add_filter( 'my_custom_persian_filter', 'persian_date_function' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.