File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1313use Cloudinary \REST_API ;
1414use Cloudinary \Settings_Component ;
1515use Cloudinary \Utils ;
16+ use WP_Screen ;
1617
1718/**
1819 * Class Gallery.
@@ -114,6 +115,11 @@ public function __construct( Plugin $plugin ) {
114115 * @return array
115116 */
116117 public function get_config () {
118+ $ screen = null ;
119+
120+ if ( function_exists ( 'get_current_screen ' ) ) {
121+ $ screen = get_current_screen ();
122+ }
117123
118124 $ config = ! empty ( $ this ->settings ->get_value ( 'gallery_config ' ) ) ?
119125 $ this ->settings ->get_value ( 'gallery_config ' ) :
@@ -133,7 +139,11 @@ public function get_config() {
133139
134140 $ credentials = $ this ->plugin ->components ['connect ' ]->get_credentials ();
135141
136- if ( ! empty ( $ credentials ['cname ' ] ) ) {
142+ // Do not use privateCdn and secureDistribution on gallery settings page.
143+ if (
144+ ! empty ( $ credentials ['cname ' ] )
145+ && ( ! $ screen instanceof WP_Screen || 'cloudinary_page_cloudinary_gallery ' !== $ screen ->id )
146+ ) {
137147 $ config ['secureDistribution ' ] = $ credentials ['cname ' ];
138148 $ config ['privateCdn ' ] = true ;
139149 }
You can’t perform that action at this time.
0 commit comments