I am trying to implement a sort function by adding a column of "Posted date" created with a custom field to the post list on the management screen.
Since it did not sort well, the date entered in "Posted date" of the custom field
I checked it with meta_vaue in the database.
Then, the formats were registered separately, such as "20201118" and "2020/11/18". ..

If anyone knows the cause of this, would you please tell me?


Custom fields are set as follows.
・ Field type: Date picker
-Display format: Custom Y/m/d
-Return value format: Custom Y/m/d

  • Answer # 1


    I'm currently working on a member site,
    Posts created or edited by members from the site will be "2020/11/18"
    The post created or edited from the WordPress administration screen was "20201118".


    When a member creates a post from the site, it was solved by adding a process to remove the slash when saving it in the DB.

    str_replace ('/','','Posted date');