{"id":311,"date":"2020-03-13T06:16:59","date_gmt":"2020-03-13T06:16:59","guid":{"rendered":"https:\/\/stockpack.co\/blog\/?p=311"},"modified":"2020-06-11T16:23:37","modified_gmt":"2020-06-11T16:23:37","slug":"stop-stockpack-from-loading-with-stockpack-load-filter","status":"publish","type":"post","link":"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/","title":{"rendered":"Stop stockpack from loading with stockpack load filter"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">You can prevent the StockPack plugin from loading on pages you do not want it to load, by default it will only load in the admin side since you might use a image field on any page. You configure where the StockPack plugin will load with the <code>stockpack_load<\/code> filter. <\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s the default for the plugin done via the filter:<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"php\" data-theme=\"monokai\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"false\">&lt;?php\n\nadd_filter( 'load_stockpack', 'stockpack_load', 10, 1 );\n\nfunction stockpack_load( $load ) {\n\tif ( ! is_admin() ) {\n\t\treturn false;\n\t}\n\n\treturn $load;\n}<\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This filter can also be used to limit the plugin for certain users in a more performant way as mentioned by our friends at <a href=\"https:\/\/www.cloudmedialab.com\/\">https:\/\/www.cloudmedialab.com\/&nbsp;<\/a><\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"php\" data-theme=\"monokai\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"false\">&lt;?php\n\n\/\/ Soft Load Stockpack\nadd_filter( 'load_stockpack', 'cmldmu_stockpack_load', 10, 1 );\nfunction cmldmu_stockpack_load( $load ) {\n\t\/\/Only load StockPack to back end\n\tif ( ! is_admin() ) {\n\t\treturn false;\n\t}\n\t\/\/Do not load StockPack unless user has custom capability, or is Administrator (via update_core capability)\n\tif ( ! ( current_user_can( 'cml_use_adobestock' ) || current_user_can( 'update_core' ) ) ) {\n\t\treturn false;\n\t}\n\n\treturn $load;\n}<\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">If you have any questions, feel free to contact us via <a href=\"https:\/\/stockpack.co\/contact\">https:\/\/stockpack.co\/contact<\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can prevent the StockPack plugin from loading on pages you do not want it to load, by default it will only load in the admin side since you might use a image field on any page. You configure where the StockPack plugin will load with the stockpack_load filter.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-311","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Stop stockpack from loading with stockpack load filter - StockPack Blog<\/title>\n<meta name=\"description\" content=\"You can prevent the StockPack plugin from loading on pages you do not want it to load, by default it will only load in the admin side since you might use a image field on any page\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Stop stockpack from loading with stockpack load filter - StockPack Blog\" \/>\n<meta property=\"og:description\" content=\"You can prevent the StockPack plugin from loading on pages you do not want it to load, by default it will only load in the admin side since you might use a image field on any page\" \/>\n<meta property=\"og:url\" content=\"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/\" \/>\n<meta property=\"og:site_name\" content=\"StockPack Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-13T06:16:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-11T16:23:37+00:00\" \/>\n<meta name=\"author\" content=\"Ionut Calara\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ionut_calara\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ionut Calara\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/stop-stockpack-from-loading-with-stockpack-load-filter\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/stop-stockpack-from-loading-with-stockpack-load-filter\\\/\"},\"author\":{\"name\":\"Ionut Calara\",\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/#\\\/schema\\\/person\\\/9112129d4a5ac02fa752ed0bd3227095\"},\"headline\":\"Stop stockpack from loading with stockpack load filter\",\"datePublished\":\"2020-03-13T06:16:59+00:00\",\"dateModified\":\"2020-06-11T16:23:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/stop-stockpack-from-loading-with-stockpack-load-filter\\\/\"},\"wordCount\":111,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/#organization\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/stockpack.co\\\/blog\\\/stop-stockpack-from-loading-with-stockpack-load-filter\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/stop-stockpack-from-loading-with-stockpack-load-filter\\\/\",\"url\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/stop-stockpack-from-loading-with-stockpack-load-filter\\\/\",\"name\":\"Stop stockpack from loading with stockpack load filter - StockPack Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/#website\"},\"datePublished\":\"2020-03-13T06:16:59+00:00\",\"dateModified\":\"2020-06-11T16:23:37+00:00\",\"description\":\"You can prevent the StockPack plugin from loading on pages you do not want it to load, by default it will only load in the admin side since you might use a image field on any page\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/stop-stockpack-from-loading-with-stockpack-load-filter\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/stockpack.co\\\/blog\\\/stop-stockpack-from-loading-with-stockpack-load-filter\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/stop-stockpack-from-loading-with-stockpack-load-filter\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Stop stockpack from loading with stockpack load filter\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/\",\"name\":\"StockPack Blog\",\"description\":\"Stock images in WordPress\",\"publisher\":{\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/#organization\",\"name\":\"StockPack Blog\",\"url\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/logo-white.png\",\"contentUrl\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/logo-white.png\",\"width\":230,\"height\":58,\"caption\":\"StockPack Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/#\\\/schema\\\/person\\\/9112129d4a5ac02fa752ed0bd3227095\",\"name\":\"Ionut Calara\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6de78df9383e3b7860eb9bed449329458a447ac1eb1281fa8cb1925cbbd27cf7?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6de78df9383e3b7860eb9bed449329458a447ac1eb1281fa8cb1925cbbd27cf7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6de78df9383e3b7860eb9bed449329458a447ac1eb1281fa8cb1925cbbd27cf7?s=96&d=mm&r=g\",\"caption\":\"Ionut Calara\"},\"description\":\"Ionut is a full stack developer with a lot of love for well-built things. He loves products that have the user in mind and strives to build good UX. When he isn't coding, he'll spend as much time as possible with family and friends.\",\"sameAs\":[\"https:\\\/\\\/ionutcalara.me\",\"Calara Ionut\",\"https:\\\/\\\/x.com\\\/ionut_calara\"],\"url\":\"https:\\\/\\\/stockpack.co\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Stop stockpack from loading with stockpack load filter - StockPack Blog","description":"You can prevent the StockPack plugin from loading on pages you do not want it to load, by default it will only load in the admin side since you might use a image field on any page","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/","og_locale":"en_US","og_type":"article","og_title":"Stop stockpack from loading with stockpack load filter - StockPack Blog","og_description":"You can prevent the StockPack plugin from loading on pages you do not want it to load, by default it will only load in the admin side since you might use a image field on any page","og_url":"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/","og_site_name":"StockPack Blog","article_published_time":"2020-03-13T06:16:59+00:00","article_modified_time":"2020-06-11T16:23:37+00:00","author":"Ionut Calara","twitter_card":"summary_large_image","twitter_creator":"@ionut_calara","twitter_misc":{"Written by":"Ionut Calara","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/#article","isPartOf":{"@id":"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/"},"author":{"name":"Ionut Calara","@id":"https:\/\/stockpack.co\/blog\/#\/schema\/person\/9112129d4a5ac02fa752ed0bd3227095"},"headline":"Stop stockpack from loading with stockpack load filter","datePublished":"2020-03-13T06:16:59+00:00","dateModified":"2020-06-11T16:23:37+00:00","mainEntityOfPage":{"@id":"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/"},"wordCount":111,"commentCount":0,"publisher":{"@id":"https:\/\/stockpack.co\/blog\/#organization"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/","url":"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/","name":"Stop stockpack from loading with stockpack load filter - StockPack Blog","isPartOf":{"@id":"https:\/\/stockpack.co\/blog\/#website"},"datePublished":"2020-03-13T06:16:59+00:00","dateModified":"2020-06-11T16:23:37+00:00","description":"You can prevent the StockPack plugin from loading on pages you do not want it to load, by default it will only load in the admin side since you might use a image field on any page","breadcrumb":{"@id":"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/stockpack.co\/blog\/stop-stockpack-from-loading-with-stockpack-load-filter\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/stockpack.co\/blog\/"},{"@type":"ListItem","position":2,"name":"Stop stockpack from loading with stockpack load filter"}]},{"@type":"WebSite","@id":"https:\/\/stockpack.co\/blog\/#website","url":"https:\/\/stockpack.co\/blog\/","name":"StockPack Blog","description":"Stock images in WordPress","publisher":{"@id":"https:\/\/stockpack.co\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/stockpack.co\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/stockpack.co\/blog\/#organization","name":"StockPack Blog","url":"https:\/\/stockpack.co\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stockpack.co\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/stockpack.co\/blog\/wp-content\/uploads\/2019\/12\/logo-white.png","contentUrl":"https:\/\/stockpack.co\/blog\/wp-content\/uploads\/2019\/12\/logo-white.png","width":230,"height":58,"caption":"StockPack Blog"},"image":{"@id":"https:\/\/stockpack.co\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/stockpack.co\/blog\/#\/schema\/person\/9112129d4a5ac02fa752ed0bd3227095","name":"Ionut Calara","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/6de78df9383e3b7860eb9bed449329458a447ac1eb1281fa8cb1925cbbd27cf7?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6de78df9383e3b7860eb9bed449329458a447ac1eb1281fa8cb1925cbbd27cf7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6de78df9383e3b7860eb9bed449329458a447ac1eb1281fa8cb1925cbbd27cf7?s=96&d=mm&r=g","caption":"Ionut Calara"},"description":"Ionut is a full stack developer with a lot of love for well-built things. He loves products that have the user in mind and strives to build good UX. When he isn't coding, he'll spend as much time as possible with family and friends.","sameAs":["https:\/\/ionutcalara.me","Calara Ionut","https:\/\/x.com\/ionut_calara"],"url":"https:\/\/stockpack.co\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/stockpack.co\/blog\/wp-json\/wp\/v2\/posts\/311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stockpack.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stockpack.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stockpack.co\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stockpack.co\/blog\/wp-json\/wp\/v2\/comments?post=311"}],"version-history":[{"count":3,"href":"https:\/\/stockpack.co\/blog\/wp-json\/wp\/v2\/posts\/311\/revisions"}],"predecessor-version":[{"id":496,"href":"https:\/\/stockpack.co\/blog\/wp-json\/wp\/v2\/posts\/311\/revisions\/496"}],"wp:attachment":[{"href":"https:\/\/stockpack.co\/blog\/wp-json\/wp\/v2\/media?parent=311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stockpack.co\/blog\/wp-json\/wp\/v2\/categories?post=311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stockpack.co\/blog\/wp-json\/wp\/v2\/tags?post=311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}