Security Measure | Description | |
---|---|---|
☐ | Use HTTPS everywhere | Prevents basic eavesdropping and man-in-the-middle attacks |
☐ | Input validation and sanitization | Prevents XSS attacks by validating all user inputs |
☐ | Don't store sensitive data in the browser | No secrets in localStorage or client-side code |
☐ | CSRF protection | Implement anti-CSRF tokens for forms and state-changing requests |
☐ | Never expose API keys in frontend | API credentials should always remain server-side |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Add this code if you would like accordions on your Category Page --> | |
<div class="container-divider"></div> | |
<div class="container"> | |
<nav class="sub-nav"> | |
{{breadcrumbs}} | |
{{search submit=false}} | |
</nav> | |
Sometimes, a customer might have data being loaded programmatically into a page and want that data to write to form fields. Because HubSpot Forms are generated programmatically with React, there need to be two considerations in your code that make setting fields programmatically more difficult:
- The data must be inserted after the form has finished loading
- Data that is inserted programmatically must have a js "change" event fired on the field in order to propagate the change into the React data layer
These two considerations are handled separately.
There are two methods to handle this - one including jQuery and one using vanilla javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function change_yoast_seo_og_meta() { | |
add_filter( 'wpseo_opengraph_desc', 'change_desc' ); | |
} | |
function change_desc( $desc ) { | |
// This article is actually a landing page for an eBook | |
if( is_singular( 123 ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Updates product prices. | |
* More about WP CLI scripts: | |
* https://wptheming.com/2021/05/wp-cli-scripts-and-woocommerce/ | |
* | |
* wp eval-file update-product-prices.php | |
*/ | |
$products = get_posts([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
More recent resolution: | |
1. cd ~/../../etc (go to etc folder in WSL). | |
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line). | |
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line). | |
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian). | |
5. cd ~/../../etc (go to etc folder in WSL). | |
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file). | |
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and | |
secondary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new WP_Query([ | |
// Standard query args. Using post__in can be much faster. If searching ACF custom | |
// database tables data, plugin the found post IDs in here. | |
'post_type' => 'post', | |
'post__in' => [1,2,3], // array of post IDs | |
// Optional args to improve performance. Use these to cut down on internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function change_link( $permalink, $post ) { | |
if( $post->post_type == 'resources_post_type' ) { | |
$resource_terms = get_the_terms( $post, 'resource_type' ); | |
$term_slug = ''; | |
if( ! empty( $resource_terms ) ) { | |
foreach ( $resource_terms as $term ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_POST['login'])) { | |
if(!isset($_POST['g-recaptcha-response']) || empty($_POST['g-recaptcha-response'])) { | |
echo 'reCAPTHCA verification failed, please try again.'; | |
} else { | |
$secret = 'google_secret_key'; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.github.io | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
*/ |
NewerOlder