This file contains hidden or 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 | |
/* | |
* Plugin Name: ACF Post Object Field With ID | |
* Description: Show & search by ID with acf post object field | |
* Author: Pierre Dargham | |
* Author URI: https://github.com/pierre-dargham/ | |
* Version: 1.0 | |
*/ |
This file contains hidden or 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
<IfModule mod_headers.c> | |
Header set X-Robots-Tag "max-snippet:-1, max-image-preview:large, max-video-preview:-1" | |
</IfModule> |
This file contains hidden or 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 | |
// composer require wesbos/burner-email-providers | |
function validate_email($email) | |
{ | |
$email = mb_strtolower($email); | |
if(!email_has_valid_format($email)) { | |
return "error: invalid email format"; |
Page avec N champs ACF relationnels
Chargemement SQL par défaut :
Les requêtes sont déclanchées lors des get_field, en cours de templating :
get_field 1 -> post 1
- 1 requete = fetch post :
SELECT * FROM wp_posts WHERE ID IN (1)
- 1 requete = fetch post meta :
SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (1)
- 1 requete = fetch post terms & taxonomies :
SELECT t.*, tt.*, tr.object_id FROM wp_terms (...) WHERE tr.object_id IN (1)
This file contains hidden or 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 | |
$max_results_per_query = 200; | |
$offset = 0; | |
$has_more_results = true; | |
while($has_more_results) { | |
$args = [ | |
'post_type' => 'example-post-type', |
OlderNewer