How to generate expiring URL?

Ok I came up with this add_action( ‘wp_loaded’, ‘my_create_questionnaire_link’); function my_create_questionnaire_link(){ // this check is for demo, if you go to http://yoursite.demo/?create-my-link, you will get your unique url added to your content if( isset( $_GET[‘create-my-link’] ) ){ // This filter is for demo purpose // You might want to create a button or a special … Read more

Get a button for in the Editor

There’s an easy way. Open functions.php and add this code. It works for many html entities // got this form http://www.sycha.com/wordpress-add-hr-button-tinymce-visual-editor function enable_more_buttons($buttons) { $buttons[] = ‘hr’; /* Repeat with any other buttons you want to add, e.g. $buttons[] = ‘fontselect’; $buttons[] = ‘sup’; */ return $buttons; } add_filter(“mce_buttons”, “enable_more_buttons”); //add_filter(“mce_buttons_2”, “enable_more_buttons”); // add to … Read more

Remove WordPress Toolbar buttons

function mytheme_admin_bar_render() { global $wp_admin_bar; $wp_admin_bar->remove_menu(‘wp-logo’); } add_action( ‘wp_before_admin_bar_render’, ‘mytheme_admin_bar_render’ ); For specific user roles you can wrap the add_action in a conditional, something like if(current_user_can(‘editor’)){ add_action( ‘wp_before_admin_bar_render’, ‘mytheme_admin_bar_render’ ); } http://codex.wordpress.org/Roles_and_Capabilities

Where should I use get_option in a plugin

Both ways are almost equal, the first will be slightly faster, because the callback is called only if the check equals to TRUE. Note you cannot test an option like this, unless the option name is really ‘my_option[option_1]’. What you probably want is: if ( $test = get_option(‘my_option’) and 1 === $test[‘option_1’] ) add_action(); An … Read more

How can I modify what is being output in wp_head, whether by a theme or WordPress in general?

First: don’t enqueue custom versions of WordPress core-bundled scripts, including (and especially) jQuery. Second, to answer your question: those Plugin scripts and stylesheets are enqueued, using add_action(), via a callback hooked into one of the following action hooks: wp_head wp_enqueue_scripts wp_print_scripts wp_print_styles (There are others, but those are the most likely.) Inside the callback, the … Read more

Renaming a WordPress Admin Menu

This is what I do to rename menu items: in the action hook admin_menu, use a recursive array search to pinpoint the key position of the desired menu and then modify the global $menu array. add_action( ‘admin_menu’, ‘rename_woocoomerce_wpse_100758’, 999 ); function rename_woocoomerce_wpse_100758() { global $menu; // Pinpoint menu item $woo = recursive_array_search_php_91365( ‘WooCommerce’, $menu ); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)