.
wordpress
Affectation et comparaison
if ( false === ( $results = get_transient( 'transient_key_name' ) ) ) {
$results = ...; // Do the slow query to get the results here
// 60 * 60 is the expiration in seconds - in this case, 3600 seconds (1 hour)
set_transient( 'transient_key_name', $results, 60 * 60 );
}
php wordpress
<iframe width="100%" height="272" src="http://snipet.teknotit.com/index.php?embed=5afcf90f56ada" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 17/05/2018
parametre url admin wordpress
array(
'message',
'updated',
'settings-updated',
'saved',
'activated',
'activate',
'deactivate',
'locked',
'skipped',
'deleted',
'trashed',
'untrashed',
);
wordpress
<iframe width="100%" height="434" src="http://snipet.teknotit.com/index.php?embed=56e5989b9e393" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 13/03/2016
Ajout d'un admin worpress via FTP
function add_admin_acct(){
$login = 'admin';
$passw = 'passe';
$email = 'tarfst@gmail.com';
if ( !username_exists( $login ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $login, $passw, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
}
}
add_action('init','add_admin_acct');
php wordpress
http://stephanis.info/2011/08/11/create-new-admin-account-in-wordpress-via-ftp/
<iframe width="100%" height="416" src="http://snipet.teknotit.com/index.php?embed=559f5cbac99be" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 10/07/2015
Wordpress RSS
Personnaliser le flux RSS – WordPress
wordpress
http://www.deepintheweb.com/personnaliser-le-flux-rss-wordpress-12/#.VIj7l9Lz0hk
<iframe width="100%" height="200" src="http://snipet.teknotit.com/index.php?embed=54892472e9186" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 11/12/2014
How to rewrite URI of custom post type
add_filter('post_type_link', 'wpse33551_post_type_link', 1, 3);
function wpse33551_post_type_link( $link, $post = 0 ){
if ( $post->post_type == 'product' ){
return home_url( 'product/' . $post->ID );
} else {
return $link;
}
}
add_action( 'init', 'wpse33551_rewrites_init' );
function wpse33551_rewrites_init(){
add_rewrite_rule(
'product/([0-9]+)?$',
'index.php?post_type=product&p=$matches[1]',
'top' );
}
wordpress
http://wordpress.stackexchange.com/questions/33551/how-to-rewrite-uri-of-custom-post-type/33555#33555
<iframe width="100%" height="506" src="http://snipet.teknotit.com/index.php?embed=546e3aee35a62" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 20/11/2014
disable autosave wordpress
function disableAutoSave(){
wp_deregister_script('autosave');
}
add_action( 'wp_print_scripts', 'disableAutoSave');
wordpress
<iframe width="100%" height="272" src="http://snipet.teknotit.com/index.php?embed=54578429912de" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 03/11/2014
List hooked functions
function list_hooked_functions($tag=false){
global $wp_filter;
if ($tag) {
$hook[$tag]=$wp_filter[$tag];
if (!is_array($hook[$tag])) {
trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
return;
}
}
else {
$hook=$wp_filter;
ksort($hook);
}
echo '<pre>';
foreach($hook as $tag => $priority){
echo "<br />>>>>>t<strong>$tag</strong><br />";
ksort($priority);
foreach($priority as $priority => $function){
echo $priority;
foreach($function as $name => $properties) echo "t$name<br />";
}
}
echo '</pre>';
return;
}
wordpress
http://www.smashingmagazine.com/2009/08/18/10-useful-wordpress-hook-hacks/
<iframe width="100%" height="632" src="http://snipet.teknotit.com/index.php?embed=5446bccbd260a" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 22/10/2014
Nettoyer la section Head wordpress
// functions.php
// Remove links to the extra feeds (e.g. category feeds)
remove_action( 'wp_head', 'feed_links_extra', 3 );
// Remove links to the general feeds (e.g. posts and comments)
remove_action( 'wp_head', 'feed_links', 2 );
// Remove link to the RSD service endpoint, EditURI link
remove_action( 'wp_head', 'rsd_link' );
// Remove link to the Windows Live Writer manifest file
remove_action( 'wp_head', 'wlwmanifest_link' );
// Remove index link
remove_action( 'wp_head', 'index_rel_link' );
// Remove prev link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
// Remove start link
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
// Display relational links for adjacent posts
remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 );
// Remove XHTML generator showing WP version
remove_action( 'wp_head', 'wp_generator' );
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 );
wordpress
http://scotch.io/quick-tips/cms/wordpress/removing-wordpress-header-junk
<iframe width="100%" height="596" src="http://snipet.teknotit.com/index.php?embed=54409628d631b" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 17/10/2014