Update to provide actual error message and attempted work-around
Error:
Warning: DOMDocument::importNode() [domdocument.importnode]: ID pricePerFt already defined in /[MY PATH]l/wp-content/plugins/remote-content-shortcode/inc/phpQuery.php on line 590
error repeats serveral times
Unsuccessful work around:
Try to replace before manipulating DOM
find='~id="pricePerFt"~' replace='~class="pricePerFt"~'
The regex worked, so it just means that selector="" happens before find/replace
Next Step:
I’ll edit the core file to suppress the error, knowing that any update will break my work-around.
@tecbrat, thanks for the email, and I just pushed an update so you may lose your changes.
In version 1.4.2 I added some filters that should accomplish what you’re looking for. Just before the content is passed to phpQuery, I am applying a filter like so:
// include phpQuery
include_once( 'inc/phpQuery.php' );
// filter the content
$response = apply_filters( 'remote_content_shortcode_phpQuery', $response, $url, $selector, $remove );
// load the response HTML DOM
phpQuery::newDocument( $response );
You can filter the response however you would like by adding a filter:
add_filter('remote_content_shortcode_phpQuery', function($response, $url, $selector, $remove) {
return 'The new content!';
}, 10, 4);