How to disable image sources
There are various ways to disable the output of image sources. Find all of them on this page.
Plugin settings
The following options can be used to control where and which image sources are displayed.
In your WordPress dashboard, go to Settings > Image Sources(?).
- Position of the image sources controls how image sources are displayed.
- Per-page list or Overlay controls which images are considered for showing credits.
- Miscellaneous settings > Standard Source controls what is displayed for images that don’t have a dedicated source string or that have the Use standard source option set.
Disable Image Source Control on specific pages
There are two hooks you can use to disable Image Source Control.
- The
isc_public_excluded_post_ids
hook allows you to disable the Image Source Control plugin on specific pages, given an array of page IDs. - The
isc_can_load
comes without parameters and can be used for general purposes.
Disabling ISC means that neither image sources are displayed, including the global sources list, nor background tasks, like indexing images on this given page, are running.
You can use the hooks to disable ISC or enable it on specific pages or page types.
A few examples:
Enable ISC only on blog posts
You can use both hooks to disable Image Source Control on non-single posts. I.e., no sources will be loaded on search results, category pages, blog archives, pages, etc.
isc_can_load
add_filter( 'isc_can_load', function( $can_load ) {
return is_single();
} );
Code language: PHP (php)
isc_public_excluded_post_ids
As you can see, this hook works through specific page IDs.
add_filter( 'isc_public_excluded_post_ids', function( $post_ids ) {
if ( ! is_single() ) {
$post_ids[] = get_the_ID();
}
return $post_ids;
} );
Code language: PHP (php)
Disable ISC on specific pages
Use the isc_public_excluded_post_ids
to disable image sources on specific pages or posts. In this case, the post ID is 123
.
add_filter( 'isc_public_excluded_post_ids', function( $post_ids ) {
$post_ids[] = 123;
return $post_ids;
} );
Code language: PHP (php)
Disabling Overlays
There are various ways to disable or hide an image text overlay.
Disable overlays after a certain position
When you place the isc_stop_overlay
string anywhere on your site, ISC will immediately stop displaying overlays for any following image. “Following” means the HTML code after that.
Ideally, you place isc_stop_overlay
as an attribute to an HTML element, e.g.,
<h2 class="isc_stop_overlay">Headline</h2>
Code language: HTML, XML (xml)
Disable overlays for certain images
Use the isc-disable-overlay
class on a given image to stop the overlay showing for it.
Technically, the class needs to be added to the <figure>
or <img>
tags. This can be done through the “Additional CSS class(es)” block option for image blocks, options in your page builder, or using custom code.
Flexible rules to hide overlays
The most flexible rule to hide overlays of certain images or in specific containers you can use CSS rules.
The following CSS selector targets any image source string in an overlay:
.isc-source .isc-source-text
Code language: CSS (css)
So, to hide them in a given element, let’s say a quote block, use a CSS rule like this one.
blockquote .isc-source .isc-source-text { display: none; }
Code language: CSS (css)