How to prevent XSS attack in wordpress theme?
XSS generally would only occur through AJAX or form handling. Verify a referrer header is actually from your FQDN and/or require a captcha, providing pseudorandom input validation.
XSS generally would only occur through AJAX or form handling. Verify a referrer header is actually from your FQDN and/or require a captcha, providing pseudorandom input validation.
How to override wordpress native options with theme options
Your code is going to cause a fatal error as you have defined a function inside a loop, and therefore are redefining the function at every iteration thereafter. That is part of the problem. Take a look at cleaned up code: function pw_show_gallery_image_urls( $content ) { global $post; // Only do this on singular items … Read more
In your array, have you tried setting depth to 0 or 2? wp_nav_menu( array( ‘theme_location’ => ‘header-menu’, ‘container_class’ => ‘navigator’, ‘depth’ => 2) ) Where 0 should be the default and allow unlimited submenu, and 2 would allow one submenu. I am not sure how this would happen, but if it works, perhaps somewhere the … Read more
I don’t really know what you mean by “using the WordPress API in a site as opposed to making it a theme” but I am assuming you mean something like “use the backend but not the front facing stuff”. So, given that, yes you can, but a lot of things will not work. There are … Read more
A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
8388608 bytes is 8M, which is the default post size limit in PHP. Update your post_max_size in php.ini to a larger value, may be 50M. post_max_size sets the maximum amount of data that can be sent via a POST in a form.
Finally, I found how to change the non-frame $button_labels of a WP_Customize_Image_Control by extending its class, not reassigning a new $type and implement an enqueue() function to enqueue a pure JavaScript code to manipulate the non-frame labels, like this to change the dynamic ‘default’ label by .addEventListener(“click”, handler) to its dynamic .button: class WP_Customize_Custom_Control extends … Read more
There are several ways you could do this. As noted above, you can call global every time you want the value: global $fburl; echo $fburl; You can put all your config settings into a single object or array, then put that one object into the globals so it’s available everywhere (doable, but not one I’d … Read more
content-single-product.php sounds like a woocommerce template, which is located here wp-content/plugins/woocommerce/templates. You can override this template in your theme or child them by creating a file wp-content/themes/your-theme/woocommerce/content-single-product.php.