Passing nonce at admin menu link

WordPress do not accept nonce in the slug that you are trying to provide in the above code. I mean in this line: ‘my_dashboard&nonce-field=’ . wp_create_nonce(‘my_action’), ‘show_dashboard’ I was facing the same issue like you are facing. As the admin menu already verified for specific users so we don’t need to verify it again with … Read more

Any ideas to trigger some code after plugin update?

I’ve always used the upgrader_process_complete hook: function my_plugins_update_completed( $upgrader_object, $options ) { // If an update has taken place and the updated type is plugins and the plugins element exists if ( $options[‘action’] == ‘update’ && $options[‘type’] == ‘plugin’ && isset( $options[‘plugins’] ) ) { foreach( $options[‘plugins’] as $plugin ) { // Check to ensure … Read more

Extending theme PHP class in plugin

Make your class visible to PHP after the theme has declared the parent class. Plugins are loaded first, the theme maybe later. This can be overridden. Theme code is available when the action after_setup_theme is fired, so you could use it like this: add_action( ‘after_setup_theme’, function() { require ‘ChildClass.php’; }); However, if the theme loads … Read more

How to filter the_content() & include content from template

My guess is that single-template.php uses the_content. Now think about what happens: Your filter causes single-template.php to load single-template.php uses the_content So single-template.php loads again Which uses the_content Which loads single-template.php Which uses the_content … I am not entirely sure how to fix that, as your question is light on detail. It is hard to … Read more

How can I limit the amount of characters used for description in the manage categories grid?

That field is not filtered in template. One way would be to filter get_terms() on that page (but I am not entirely sure that won’t break something): add_action( ‘admin_head-edit-tags.php’, ‘admin_edit_tags’ ); function admin_edit_tags() { add_filter( ‘get_terms’, ‘admin_trim_category_description’, 10, 2 ); } function admin_trim_category_description( $terms, $taxonomies ) { if( ‘category’ != $taxonomies[0] ) return $terms; foreach( … Read more

Theme Install using a Custom Repository

Not exactly. The existing system is set up as a 2-part integration between your individual blog and the API at WordPress.org. You enter a search term, and your blog retrieves information from WordPress.org. Then you can download themes from the same location. That kind of integration doesn’t exist anywhere else because, well, no one’s bothered … Read more