oweux
Forum Replies Created
-
Forum: Plugins
In reply to: [Posts in Page] post_type=’attachment’post_status also needs to be set using:
post_status=’inherit’
for attachments to be processed.
- This reply was modified 6 years, 1 month ago by oweux.
We had a similar situation in which images hosted on third party websites had their urls re-rewritten by this plugin instead of being left alone. I understand this is not your particular issue but you may edit as3cf-filter.php and create your own code to check for your particular condition and override it. Others might find it useful. This page lead me to the correct file to edit.
What we did was add the following:
protected function should_process_host($url_found, $url_wp){ $src_host_names = explode(".", parse_url($url_found, PHP_URL_HOST)); $src_host_names = array_slice($src_host_names, -2); $src_host_names = implode('.', $src_host_names); $wp_host_name = explode(".", parse_url($url_wp, PHP_URL_HOST)); $wp_host_name = array_slice($wp_host_name, -2); $wp_host_name = implode('.', $wp_host_name); if ($src_host_names !== $wp_host_name) { // OR if(strpos($wp_host_name, $src_host_names)) return false; } }
Then add:
if (!$this->should_process_host($url, get_site_url())) { // URL is foreign, skip continue; }
within the “foreach ($matches as $url)” loop in:
get_urls_from_content
get_urls_from_img_srcYou may want to adjust “-2” on array_splice depending on how ‘deep’ you need to host comparison.
The fix is not ideal because it will get overwritten on each update.
[Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]