Chauncey McAskill
Forum Replies Created
-
Thank you.
The latest pre-release (v3.7.3-5492) looks good on my end.
Thank you for the fix.
The changes in the pre-release introduce a couple of issues.
In the
getContentDir()
method, the addedwp_mkdir_p()
function returns eithertrue
orfalse
whereas the method expects either a string (the path) orfalse
. If thatmkdir
function returnstrue
(which will be the case upon the first attempt), it will break file paths on that first request:$folder = \apply_filters('DevOwl/DeliverAnonymousAsset/ContentDir', $folder); if (!\wp_is_writable($folder)) { - return \false; + return \wp_mkdir_p($folder); } return $folder;
In
generateSrc()
method, usingABSPATH
assumes the Web site is installed in a classic WordPress fashion (where WordPress is the document root). This won’t work with any modern structure like Bedrock that puts WordPress in an adjacent subdirectory of the document root:+ if (\has_filter('DevOwl/DeliverAnonymousAsset/ContentDir')) { + // This is more expensive (https://wordpress.stackexchange.com/a/264870/83335), so check if a filter is given + return \str_replace(\wp_normalize_path(\untrailingslashit(ABSPATH)), \site_url(), \wp_normalize_path($contentPath)); + } return self::getContentUrl() . \basename($contentPath);
Unfortunately, there’s no reasonable way to resolve the document root in relation to the filtered content directory.
If adding a
ContentUrl
filter to pair withContentDir
is not an option, theContentDir
filter could be changed to be a path relative toWP_CONTENT_DIR
:/** * Get the content directory where anonymous assets should be placed. * * If you change the directory, the old assets are not deleted automatically as this could break * the cache of caching plugins like WP Rocket. * * @hook DevOwl/DeliverAnonymousAsset/ContentDir * @param {string} $folder * @return {string} */ $folder = \wp_normalize_path(\constant('WP_CONTENT_DIR') . '/' . \apply_filters('DevOwl/DeliverAnonymousAsset/ContentDir', '')); if (!\wp_is_writable($folder) && !\wp_mkdir_p($folder)) { return false; } return \trailingslashit($folder);
Looking at the left screenshot, the URL is still pointing to
/wp-content/XYZ.js
.I forgot to mention that when one changes the content directory path, the previous path will still contains the initial anonymized assets. They are not automatically deleted. If you force new hash file names, you’ll see these JS resource requests fail since the new content directory will be the one with the newly named files.
[…] we have not added a filter for the resulting URL as the folder needs to be checked if writable with
wp_is_writable
, this cannot be done with a URL.But you wouldn’t use
getContentUrl()
to check if the path is writable, you would usegetContentDir()
.This is the hook I used to test the feature:
add_filter( 'DevOwl/DeliverAnonymousAsset/ContentDir', fn ( $content_dir ) => wp_upload_dir()['basedir '] );
This filter works as expected, the anonymized assets are stored in the desired location (in this case, in the uploads directory).
Thanks for the rapid response.
Full compliance with WCAG 2.1 will be appreciated.
Until then, could there be an intermediate step forward by replacing the button and link shaped
<div>
elements with<button type="button">
elements?Similarly, can the banner be injected after the opening
<body>
tag instead of the before the closing</body>
tag?Take care,
Actually, my bad. There’s a fault in the logic. It should be:
$post_type_object = get_post_type_object( $post_type ); if ( ! $post_type_object || ! is_string( $post_type_object->has_archive ) ) { return null; }
I’m seeing the same warning.
I have not traced it yet but this method does not account for the possibility that
get_post_type_object()
can returnnull
. I’ve patched it in my project like so:$post_type_object = get_post_type_object( $post_type ); if ( $post_type_object && ! is_string( $post_type_object->has_archive ) ) { return null; }
I’ve also encountered this deprecation notice.
I encountered the same database error on a fresh installation of WordPress.
The issue stems from the scheduled event:
do_action_ref_array('delete_404_logs'), WP_Hook->do_action, WP_Hook->apply_filters, SlimSEO\Redirection\Loader->run_schedule, SlimSEO\Redirection\Database\Log404->delete_older_logs
Which does not check if the table exists.
The table is only ever created here when visiting the Settings page:
apply_filters('admin_print_styles-settings_page_slim-seo'), WP_Hook->apply_filters, SlimSEO\Redirection\Settings->enqueue
To resolve this error, the plugin would either need to:
- Create the table sooner such as when the Redirection module is enabled (which is enabled by default).
- Ensure the table exists before deleting older logs (such as with
"SHOW TABLES LIKE {$wpdb->slim_seo_404}"
. - Ensure “Enable 404 logs” is turned on.
- This reply was modified 1 year, 10 months ago by Chauncey McAskill.
- This reply was modified 1 year, 10 months ago by Chauncey McAskill.
Forum: Plugins
In reply to: [Polylang] How to delete orphaned translation relationshipsFollow up; is there a way to delete all translations in a given language without having to bulk delete each post type / taxonomy in the Admin?
Forum: Plugins
In reply to: [Enhanced Media Library] Compatibility issue with Polylang+1
Initially reported this issue with Polylang.
Forum: Plugins
In reply to: [Polylang] Linked drafts lose their association after updatingSorry for the spamming.
Forum: Plugins
In reply to: [Polylang] Linked drafts lose their association after updatingAfter testing each activated plugin, the culprit is Enhanced Media Library (currently installed version: 2.3.1).
For unknown reasons,
language
andpost_translation
taxonomies were assigned to Media Library for each post type. I’ve disabled their association but the draft issue remains.Forum: Plugins
In reply to: [Polylang] Linked drafts lose their association after updatingAfter testing each activated plugin, the culprit is Enhanced Media Library (currently installed version: 2.3.1).
For unknown reasons,
language
andpost_translation
taxonomies were assigned to Media Library for each post type. I’ve disabled their association but the draft issue remains.