How to remove/hide action links cluttering under specific plugins’ names

You have the right approach. You will want to use the admin_enqueue_scripts hook: add_action( ‘admin_enqueue_scripts’, ‘wpse_239302_hide_action_links’ ); function wpse_239302_hide_action_links() { global $pagenow; if ( $pagenow == ‘plugins.php’ ) { ?> <style type=”text/css”> .visible .proupgrade, .visible .docs, .visible .forum, .visible .jetpack-home, .visible .support { display: none; } </style> <?php } }

Modify featured image URL at runtime

HTML generated by the_post_thumbnail() & get_the_post_thumbnail() can be altered using the post_thumbnail_html filter. This works even when there is no post thumbnail. Example: /** * Filters the post thumbnail HTML. * * @since 2.9.0 * * @param string $html The post thumbnail HTML. * @param int $post_id The post ID. * @param string $post_thumbnail_id The … Read more

Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)

Why it is added in the footer: This is the expected behaviour. Since you have enqueued the style within your Shortcode hook function, by the time it executes, WordPress is already done generating the <head> section of your page, since WordPress will only execute your shortcode function once it has found the shortcode in your … Read more

How do I retrieve a list of popular plugins using the WordPress.org Plugin API?

I was wrong in the earlier version of the answer and 1.1 version of the API does support this via GET request. The basic request would be: https://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[browse]=popular And you can add more parameters by sticking with request passed as “array” (in GET interpretation of). See the [poor] documentation in Codex and links from there … Read more

wp_insert_user – how to send verification email before logging in

1. Insert user data into wp_users table. Create a page called “Activation” or similar to it and get the ID of that page. An activation email will be sent with the activation link to the user. function new_user($data) { // Separate Data $default_newuser = array( ‘user_pass’ => wp_hash_password( $data[‘user_pass’]), ‘user_login’ => $data[‘user_login’], ‘user_email’ => $data[‘user_email’], … Read more

Function to activate WordPress theme inside a plugin

Of course there’s a function for that (Codex): switch_theme( $stylesheet ) It: Switches current theme to new template and stylesheet names. Accepts one argument: $stylesheet of the theme. ($stylesheet is the name of your folder slug. It’s the same value that you’d use for a child theme, something like twentythirteen.) It also accepts an additional function signature … Read more

WooCommerce – Call to undefined function is_woocommerce()

If you want to check one Plugin’s Function / Class etc. from another Plugin, then it’s best to use a hook like plugins_loaded. Based on this, your Plugin CODE will look like: <?php /* Plugin Name: YOUR PLUGIN NAME */ defined( ‘ABSPATH’ ) or exit; add_action( ‘plugins_loaded’, ‘plugin_prefix_woocommerce_check’ ); function plugin_prefix_woocommerce_check() { if( function_exists( ‘is_woocommerce’ … Read more

Allowing Custom Capability to Manage Plugin Options

If you use the Settings API, that $option_page is the value of a hidden <input> field generated by settings_fields(). For example: <input type=”hidden” name=”option_page” value=”{Option group name}”> So if you have settings_fields( ‘my-group’ ) in your code, then the $option_page would be my-group. See the (as of writing, 5th) note here. Code sample: (tried and … Read more

Gutenberg: How to use output of php render_callback function in the block editors backend?

I think that you are missing the PHP registration of the block. The JS definition is all right, but you need to tell PHP that the block exists. Can you try to register your block in your plugin or function.php file? Here is an example https://developer.wordpress.org/block-editor/tutorials/block-tutorial/creating-dynamic-blocks/ <?php function simpletoc_toc_render_callback( $attributes, $content ) { return ‘This … Read more