Can’t use /wp-json/wp/v2/plugins API endpoint even as administrator

SUGGESTIONS I suggest the following: first ensure you are running WordPress version 5.5.* as this version adds the endpoints for /wp/v2/plugins see: New and modified REST API endpoints in WordPress 5.5 using basic authentication issue a request as per the following using curl curl –user username:password https://example.com/wp-json The first request should succeed regardless because it … Read more

Validation Function for URL in plugin

I would look into PHP’s parse_url() and/or filter_var() with FILTER_VALIDATE_URL filter. parse_url() gives you a bit more control. Combine that with a sanitization as mentioned at the end. Here are couple use cases that will hopefully give you a better idea on how to proceed: If you want to verify that the url’s domain is … Read more

Add custom meta box on Post page

You need to use the add_meta_box function add_action( ‘add_meta_boxes’, ‘my_custom_meta_box’ ) ); function my_custom_meta_box(){ $args = array(); add_meta_box( ‘my_metabox_id’, __( ‘My Meta Box’, ‘my_textdomain’ ), // Title ‘my_callback_function’, // Callback function that renders the content of the meta box ‘post’, // Admin page (or post type) to show the meta box on ‘side’, // Context … Read more

Can WordPress handle these functionalities?

I really like BuddyPress for interactive communities, so I tend to go overkill and use it for anything that might possibly evolve to need its functionality in the future. Combine it with an events plugin like Buddyvents or EventPress to create a much richer user experience than you’d have with just an events plugin alone. … Read more

Show list of loaded php files from plugins

In setup, set the plugin folder root: $this->plugin_root = wp_normalize_path( WP_PLUGIN_DIR ); Then modify filter to check if file is in theme root or plugin root: return $this->switch && ( strpos($norm, $this->root) === 0 || strpos($norm, $this->plugin_root) === 0 ); or to show all included files, don’t filter any of the results in grab: return … Read more

Use comments as notes, visible for comment author only

I used _s as a template. The comments are loaded with wp_list_comments( array( ‘callback’ => ‘_s_comment’ ) ); and then comments are styled with _s_comment(). That is what you will use. You can use get_current_user_id() to get the current user id. $current_user_id = get_current_user_id(); You can get the user id of the commenter with $comment->user_id. … Read more

How to call a function in wordpress plugin from another site

There are two way you can implement this 1. Use the AJAX API This is the fastest way of doing it. Just register an ajax action and use that action url to send requests. Example add_action(‘wp_ajax_api-call’, ‘wpse_156943_ajax_api_handle_request’); function wpse_156943_ajax_api_handle_request(){ // security check validation // do whatever you want to do } The url for the … Read more