need to modify expiry date of 2000+ events of a specific category

Hey ,

We have a multiple categories in the events + custom post type and we need to modify ( extend expiry dates) of all the events in that category.

Is there any simpler way of doing it from wordpress backend.

if it cannot be done from wp backend we are wiling to do it using custom mySQL script. if this is the case could you provide a script on how to do it or guide us in the correct direction.

it would be great if you could consider this as a feature request as well.

Regards,
Shailendra

  • Sajid

    Hi @Madan,

    Hope you are doing good today :slight_smile:

    Right now there is no option to bulk edit events data and time. Its already added in a feature request back in 2013 but did not get any support (+1's) from members of community so that is why its still there.
    You can chime in and add your support there.
    https://premium.wpmudev.org/forums/topic/bulk-edit-or-quick-edit-events

    However, I am also flagging SLS (code experts) for their invaluable feedback on this matter. They will come up with a code snippet or SQL query if possible as soon as possible.

    Take care and have a nice day :slight_smile:

    Kind Regards,
    Sajid J

  • Jude

    Hey @Madan

    Thanks for getting in touch !!

    SELECT wp_X_postmeta.*
    FROM wp_X_posts
    INNER JOIN wp_X_term_relationships
    ON (wp_X_posts.ID = wp_X_term_relationships.object_id)
    INNER JOIN wp_X_postmeta
    ON ( wp_X_posts.ID = wp_X_postmeta.post_id )
    WHERE 1=1
    AND ( wp_X_term_relationships.term_taxonomy_id IN (3) )
    AND ( ( wp_X_postmeta.meta_key = 'incsub_event_end' ) )
    AND wp_X_posts.post_type = 'incsub_event'
    AND ((wp_X_posts.post_status = 'publish'))

    Put your category ID in place of 3 and the sub site ID in place of X ( remove _X_ if its a single site) and you should have a list of the entries that need updating.

    Then simply loop through each one and update like shown below ( put your date first )

    UPDATE wp_db_prefix.wp_X_postmeta SET meta_value = '2015-18-18 23:59:00' WHERE wp_X_postmeta.meta_key = 'incsub_event_end' ;

    Hope that helps.

    Jude

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.