Allow only 1 taxonomy per custom post type [duplicate]

Here’s the JS I use to replace checkboxes for radio buttons. function checktoradio(){ echo ‘<script type=”text/javascript”>jQuery(“#categorychecklist-pop input, #categorychecklist input, .cat-checklist input”).each(function(){this.type=”radio”});</script>’; } add_action(‘admin_footer’, ‘checktoradio’); This would also work for custom terms, you just need to find out the custom term ID used by inspecting the metabox element. You would place this code inside functions.php. It … Read more

Why does WordPress have a noop.php file?

The description on top of the page you have linked gives an explanation: Create a new file, wp-admin/includes/noop.php, which loads all of the noop functions for load-script|styles.php and is only loaded by those files. DRYs in the process. See #33813. Additionally there is the trac ticket #33813 linked, which gives some additional insight. You generally … Read more

Custom Filter in WordPress to modify footer information via plugin?

Most of the footer is straight-up PHP/HTML markup. You apply filters to dynamic content, which is why there isn’t a typical footer “filter.” That said, it’s relatively easy to add your own filters to WordPress. Let’s say your footer.php consists of the following: </div> <!– close main content div> <div id=”footer”> <p class=”copyright”>Copyright 2011 By … Read more

template_include (overriding default plugin templates via current theme)

So the template_redirect is used for things such as canonicalisation, feeds etc. If you want to alter the template that is served template_include is preferred. Unlike template_redirect, template_include is a filter which filters the path of the template page. This means you don’t load/include the template, but just return the template path. WordPress does a … Read more

How to stop showing admin notice after close button has been clicked

Two ways to handle this. a. Attach a timer to the notice: You could attach a 3-second timer (or however long you wish) to the notice, as follows: <?php set_transient( “my-plugin”, “alive”, 3 ); add_action( ‘admin_notices’, function() { //Syntax correction if ( “alive” == get_transient( “my-plugin” ) ) { ?> <div class=”notice notice-success is-dismissible”> <p><?php … Read more

How to check username/password without signing in the user

There is a function in the user.php of the core files called wp_authenticate_username_password that seems like what you’re looking for. If you want to avoid throwing in the $user object (you probably only have the username + password), then just throw null as 1st function argument in: $check = wp_authenticate_username_password( NULL, ‘some_username’, ‘#thepassw0rd’ ); You … Read more