Yoast / yoast-acf-analysis

WordPress plugin that adds the content of all ACF fields to the Yoast SEO score analysis.
https://wordpress.org/plugins/acf-content-analysis-for-yoast-seo/
GNU General Public License v3.0
61 stars 20 forks source link

Wrong date format for ACF date picker field #330

Open josevarghese opened 1 year ago

josevarghese commented 1 year ago

Moved from Jira: https://yoast.atlassian.net/browse/IM-1818 Reporter: @amboutwe

Description ACF includes a date picker field type. Yoast SEO automatically adds custom fields to the variable list. When adding the date picker ACF field to the title or description, the output uses the unformatted date instead of the format selected in ACF options.

This happens with or without the ACF + Yoast glue plugin.

Video: https://watch.screencastify.com/v/344zczyb1179n3of5ZDe

To Reproduce

Steps To Reproduce

Starting with a vanilla installation:

  1. Install and activate Advanced Custom Fields
  2. Create a custom field (steps below)
  3. Go to Admin > Posts > Add new
  4. Create a new post 'Yoast date test' and pick a date in the ACF metabox.
  5. Add some content and publish the post
  6. Go to Admin > Appearance > Theme File Editor
  7. Edit 'header.php' and add the lines below to the end of the file
  8. Click 'Update File'
  9. View post created with the above steps - See formatted date and unformatted date.
  10. Install and activate Yoast SEO (free)
  11. Edit post created with the above steps
  12. Add the 'Date (custom field)' variable at the start of the SEO title
  13. View post - See title has the unformatted date
  14. Install and activate ACF Content Analysis for Yoast SEO
  15. View post - See title still has the unformatted date

Create custom field

  1. Go to Admin > Custom fields > Add new
  2. Enter 'Yoast date test' in the title
  3. Click 'Add Field'
  4. Field Label = Date
  5. Field Name = date
  6. Field Type = Date picker
  7. Display Format = F j, Y
  8. Return Format = F j, Y
  9. Click 'Publish'

Add snippet to header.php

<?php
$pluginList = get_option( 'active_plugins' );
$plugin = 'advanced-custom-fields/acf.php'; 
if ( in_array( $plugin , $pluginList ) ) { ?>
<p style="margin-left: 3em">Date (no formatting): <?php the_field('date', false, false); ?> <br />Date (formatting): <?php the_field('date'); ?></p>
<?php }
?>

Expected Results

Date to use the display format from ACF

Actual Results

The unformatted date is shown

Impact ACF users that want to show the ACF date field in the title or description.

WordPress version : 5.9.2

josevarghese commented 1 year ago

Please inform the customer of conversation # 961892 when this conversation has been closed.

josevarghese commented 1 year ago

Please inform the customer of conversation # 881923 when this conversation has been closed.

backupsideag commented 5 months ago

i have the same problem, can someone help me?

Thanks in advance!

josevarghese commented 5 months ago

Hi @backupsideag

This issue still needs to be fixed, and it's on our development team's radar. Our product team will assess the severity of the issue and assign a priority level to the report. Our developers work on the highest priority issues first. We cannot give you an estimate of when they'll start working on the issue.