How to get current post user id

To show author avatar per post inside loop you need to modify a little: $current_post_author_id = get_the_author_meta( ‘ID’ ); <?php if (!empty(get_user_meta($current_post_author_id, ‘user_avatar’, true))): ?> <img src=”https://wordpress.stackexchange.com/questions/317789/<?php echo get_user_meta($current_post_author_id,”user_avatar’, true); ?>” alt=”some text”> Try, if it works for you.

Writing a plugin which needs to upload files

I think this could be part of the solution you’re looking for: https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_handle_upload_prefilter How familiar are you with web-forms in php & file-uploads in general? Here’s a prebuilt plugin solution for frontend uploads: https://wordpress.org/plugins/frontend-uploader/ & here’s a tutorial which looks to be along the lines of what you’re describing: https://www.inkthemes.com/code-to-integrate-wordpress-media-uploader-in-plugintheme/

Self deactivate plugins after an action occurs

The deactivate_plugins() function is available only after the admin_init action is executed, you will either need to register ‘admin_init’ filter and run the deactivate_plugins() function there or manually include the wp-admin/includes/plugin.php file. I updated your code with the second solution below. class WP_X_Plugin{ public function __construct(){ register_activation_hook( __FILE__, array( $this , ‘activate’ ) ); $url … Read more