Thanks for the help I want to know how I can simplify my code to just this
There is some way to add in custom field for each post and on every page of publication it is displayed to configure and when the time comes it automatically changes to expired