Closed jeffpaul closed 2 months ago
Note that running this blueprint now gives an error:
Sorry, you are not allowed to access this page.
Note that running this blueprint now gives an error:
Sorry, you are not allowed to access this page.
I am seeing the same thing. I thought maybe our settings URL had changed but that isn't the case.
What seems to be happening is we add a custom capability to the admin role that allows access to this page. This capability is added via the register_activation_hook
function and on the admin_init
hook. My assumption here is the register_activation_hook
function never runs. If in the Playground you navigate to another admin URL and then back to the settings page, things work, as the admin_init
hook will then fire. I think this is similar to an issue we reported that was impacting Publisher Media Kit (https://github.com/WordPress/wordpress-playground/issues/911) though that did get fixed so assuming this is slightly different.
For now I've updated our blueprint to manually run the function that adds that custom capibility and things do work for me now. Can test that out with this link:
https://playground.wordpress.net/#{%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin/options-general.php?page=adstxt-settings%22,%22preferredVersions%22:{%22php%22:%227.4%22,%22wp%22:%22latest%22},%22phpExtensionBundles%22:[%22kitchen-sink%22],%22steps%22:[{%22step%22:%22login%22,%22username%22:%22admin%22,%22password%22:%22password%22},{%22step%22:%22setSiteOptions%22,%22options%22:{%22permalink_structure%22:%22/%25postname%25/%22}},{%22step%22:%22installPlugin%22,%22pluginZipFile%22:{%22resource%22:%22wordpress.org/plugins%22,%22slug%22:%22ads-txt%22},%22options%22:{%22activate%22:true}},{%22step%22:%22runPHP%22,%22code%22:%22%3C?php%20require_once%20'wordpress/wp-load.php';%20$adstxt_id%20=%20wp_insert_post(%20array(%20'post_title'%20=%3E%20'Ads.txt',%20'post_content'%20=%3E%20'#%20Example%20information\ncontact=test@example.com\n\n#%20Example%20record\ngoogle.com,%20pub-1234567890,%20DIRECT,%20f08c47fec0942fa0',%20'post_status'%20=%3E%20'publish',%20'post_type'%20=%3E%20'adstxt'%20)%20);%20$app_adstxt_id%20=%20wp_insert_post(%20array(%20'post_title'%20=%3E%20'App-ads.txt',%20'post_content'%20=%3E%20'#%20Example%20information\ncontact=test@example.com\n\n#%20Example%20record\ngoogle.com,%20pub-1234567890,%20DIRECT,%20f08c47fec0942fa0',%20'post_status'%20=%3E%20'publish',%20'post_type'%20=%3E%20'app-adstxt'%20)%20);%20if%20(%20!%20$adstxt_id%20instanceof%20WP_Error%20)%20{%20update_option(%20'adstxt_post',%20(int)%20$adstxt_id%20);%20}%20if%20(%20!%20$app_adstxt_id%20instanceof%20WP_Error%20)%20{%20update_option(%20'app_adstxt_post',%20(int)%20$app_adstxt_id%20);%20}%20\\AdsTxt\\add_capabilities();%22}]}
Seems then I need to update the link in the README.md
badge from https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/10up/ads-txt/develop/.wordpress-org/blueprints/blueprint.json to the one you provided above @dkotter?
Description of the Change
Adds a badge linking to a WP Playground instance instead of the release version badge. Also adds badges for various GH Actions.
How to test the Change
Use GH markdown previewer.
Changelog Entry
n/a
Credits
Props @jeffpaul.
Checklist: