Reduce nonce lifespan

Yes, using that filter will affect the lifespan of all nonces created after this filter is added, and while it remains in-place. So your best bet is to add it, create the nonce, remove it: function my_nonce_lifetime() { return 600; // 10 minutes } add_filter( ‘nonce_life’, ‘my_nonce_lifetime’ ); $nonce = wp_create_nonce(‘wp_rest’); remove_filter( ‘nonce_life’, ‘my_nonce_lifetime’ );

Increase Size Limit of Media Files WordPress 4.1

The limiting factor appears to be in your .htaccess file: php_value post_max_size 1M The post_max_size needs to be at least equal to the upload_max_filesize, so increase that to 100M. The settings in .htaccess should override the settings in php.ini. Edit: If that doesn’t work, and since you have full root privileges, you can modify the … Read more

Template for different category on woocommerce product [closed]

Woocommerce has it’s own function woocommerce_get_template_part() for loading template parts, use it like this: woocommerce_get_template_part( $slug, $name ); which refers to the according file {$slug}-{$name}.php or used like this: woocommerce_get_template_part( $slug ); refers to the file {$slug}.php, it automatically Looks in yourtheme/slug(-name).php and yourtheme/woocommerce/slug(-name).php it can be used with a conditional like this: if( has_term( … Read more

How do I change the description of the same image which is to be found in multiple instances?

Plugin idea #1 When we insert an image into the editor, the plugin automatically modifies the caption and the alt attribute to: Then on the front-end the image caption is fetched for the corresponding image attachment, based on the attachment_729 string and replaces the ###ALT### and ###CAPTION### dummy values. So when we want to modify … Read more

Understanding apply_filters

Well, apply_filter creates a global filter hook which can be used dynamically all over the system. Which gives you the ability to filter the content of the $instance[‘title’], means you can over ride the content as well as can modify the content. Here is the example- add_filter( ‘widget_title’, ‘widget_title_to_uppercase’, 10, 1); function widget_title_to_uppercase( $content ){ … Read more

Change post permalink to external URL from custom field

Filter post_link (or post_type_link for custom post types), fetch and validate the post meta value, then return that instead of the original link. As a plugin: <?php /** * Plugin Name: External Permalinks * Plugin URI: http://wordpress.stackexchange.com/q/64285/73 * Description: Uses the value of post meta field <code>syndication_permalink</code> as permalink if available. * Version: 2012.11.13 * … Read more

Pages with 2 Columns

Here is an interesting approach: THE PLAN AND LOGIC: Custom fields are a build in functionality that will fit our needs perfectly. We can set a new custom field and then use that field to enter and store our custom data. We can then use a widget to display this custom content in the sidebar … Read more

Top 3 posts in last week ordered by Facebook and Twitter share counts

This is a bit of a multi-part question, so you’re getting a multi-part answer. Getting the Facebook count can be done by making a request to https://graph.facebook.com/URL. This will return a json object which contains, among other things, the number of “shares”. Working example which has 4 shares as of this writing: https://graph.facebook.com/http://ottopress.com/2011/wp-quickie-adding-chrome-voice-search/ Getting the … Read more