Restrict individual category combinations

Okay, I’ve had a couple minutes free time, so I wrote up a small plugin. 😉 The following goes into a new plugin file tf-restrict-categories/tf-restrict-categories.php: The introduction <?php /** * Plugin Name: Restrict Categories * Description: Individually restrict category combinations. * License: MIT * License URI: http://opensource.org/licenses/MIT * Text Domain: tf-restrict-categories * Domain Path: /languages … Read more

How can I pass a variable to wp_ajax action?

You’d need to put the variable’s value onto the page so that javascript can pass it back to PHP using ajax. Ajax functions are a completely separate “page load” so even if you made it global it won’t work. The best way to do this is using “wp_localize_script” (https://codex.wordpress.org/Function_Reference/wp_localize_script) Here’s an full example of how … Read more

Extension preview disapeared since WP 4.5.2

Your error log does tell you the reason, it’s the part about: Refused to display … in a frame because it set to ‘X-Frame-Origin’ to ‘SAMEORIGIN,DENY’ And the reason for that is the one about “conflicting values” before it. WordPress core only sends SAMEORIGIN value in admin screens, via send_frame_options_header(). So DENY is coming from … Read more

How to enable Admins to see Plugins

Have a look at the Network Admin Settings screen (in my installation, it’s at example.com/wp-admin/network/settings.php). Tucked away down near the bottom is this: Menu Settings Enable administration menus [] Plugins Checking that box should allow your users to see the Plugins menu in their sites’ back end. (I don’t think it’ll allow them to install … Read more

how to customize hello dolly plugin?

In your theme, add a custom action in a template where you want to show the output: do_action( ‘show_lyrics’ ); This does nothing for itself. Now you can add the function hello_dolly as a callback for that action in your functions.php: if ( function_exists( ‘hello_dolly’ ) ) { add_action( ‘show_lyrics’, ‘hello_dolly’ ); }

Disable text tab on WordPress text-editor

For disabling the text tab for all users except administrators, you can add the following: function my_editor_settings($settings) { if ( ! current_user_can(‘administrator’) ) { $settings[‘quicktags’] = false; return $settings; } else { $settings[‘quicktags’] = true; return $settings; } } add_filter(‘wp_editor_settings’, ‘my_editor_settings’);