You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your enhancement related to a problem? Please describe.
The options app_adstxt_post and adstxt_post are used to refer to the post ID for the relevant file.
In the event these options are deleted, a new post of the type app-adstxt or adstxt will be created the next time an admin visits the management screen. The unreferenced post will remain as published in the database.
Once a post and the option have become detached, the post should be deleted. There are a number of options:
delete the post if the option is deleted or updated
upon visiting the settings page, if a new post is created remove any old posts
recover orphaned posts -- this is problematic in that the served ads.txt file could contain unexpected data
Designs
No response
Describe alternatives you've considered
preventing the option from being deleted
This is possible by hooking in to an *_option hook.
However, the option is only likely to be altered via /wp-admin/options.php, WP CLI or by modifying the database directly. Blocking deletion of the option to sufficiently advanced users isn't practical and likely to lead to more people hitting the database directly.
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Once the options are deleted, the revision history is lost as an ads.txt post is created from scratch, without any revisions.
However, maybe the plugin could look for an orphaned post and use that if the option has been deleted. That would prevent multiple ads.txt post types been created and restore the revisions from the previous version.
Once the options are deleted, the revision history is lost as an ads.txt post is created from scratch, without any revisions.
However, maybe the plugin could look for an orphaned post and use that if the option has been deleted. That would prevent multiple ads.txt post types been created and restore the revisions from the previous version.
@peterwilsoncc I've added an initial commit on this PR #138 to clean orphaned posts and it's working but needs your opinion on triggering the function! currently, I use admin_init hook to trigger the callback function which is not the best option I guess, should we trigger the function on saving adstxt posts? Thanks
Update: I've moved the function into admin.php, so that function can be triggered while visiting the settings page :)
Is your enhancement related to a problem? Please describe.
The options
app_adstxt_post
andadstxt_post
are used to refer to the post ID for the relevant file.In the event these options are deleted, a new post of the type
app-adstxt
oradstxt
will be created the next time an admin visits the management screen. The unreferenced post will remain as published in the database.Once a post and the option have become detached, the post should be deleted. There are a number of options:
Designs
No response
Describe alternatives you've considered
preventing the option from being deleted
This is possible by hooking in to an
*_option
hook.However, the option is only likely to be altered via
/wp-admin/options.php
, WP CLI or by modifying the database directly. Blocking deletion of the option to sufficiently advanced users isn't practical and likely to lead to more people hitting the database directly.Code of Conduct
The text was updated successfully, but these errors were encountered: