In a nutshell you cannot literally do this. For plugins and themes WordPress erases whole folder on update and unpacks full folder with new version in its place. You could emulate it by temporarily moving folder away and back, but that is inherently faulty solution.
Extension folders are essentially not meant to contain content in them. In more professional environments they very well might be locked down to read only and updates might be managed completely outside of WordPress (via version control or dependency management).
You can (and should) reliably write any content only to WP’s content folder.
Related Posts:
- How to debug a plugin with Xdebug?
- function deactivate_plugins does not exist
- what’s the meaning of the field wp_capabilities in table wp_usermeta
- What is wrong with using add_option with Multisite instead of add_blog_option in a plugin
- Is there widely accepted phpDoc syntax for documenting which hook calls a function?
- Make Categories and Tags required in admin
- Getting wrong relationship value in $args in wp_Query?
- wp_schedule_event in a class
- custom XMLRPC method plus authentication of user & WooCommerce order
- How to extend LINK TO functionality in ATTACHMENT DISPLAY SETTINGS
- How do I Make a Theme “plugin-ready”?
- How to iterate through custom posts and add the title to an array
- WordPress Terminology Options Vs. Settings
- How to modify post content before writing to database?
- How to create Image gallery Metabox in wordpress [closed]
- Display only certain posts based on visitor’s country?
- Is it possible to create an action hook using do_action() within add_action()?
- Custom user profile, registration, login page with theme
- Plugin Sidebar is not Saving Meta Attribute to Post/Page after “Update”
- Possible to preset a widget’s contents via a plugin script?
- $wp_filesystem returns NULL. What are the dependencies?
- Need specific kind of “Poll Voting” for WordPress [closed]
- Install widget on plugin activation
- Plugin admin page meta_box toggle and order state not saving
- Synchronize custom post type tags with WordPress default post type tags
- Prevent Javascript Facebook SDK Conflicts in plugin
- Integrating Stripe PHP library into a custom WordPress Plugin
- How to change the URL pattern for single post view
- What for the tables ending with the meta used in database of wordpress?
- How to create custom field in worpdress default widgets?
- Ensure function has completed before allowing another Ajax call
- Loading scripts with wp_register_script and wp_enqueue_script
- Change the ‘published on’ text?
- WordPress is automatically linking plain text email addresses
- Is Using WordPress Supplied WYSIWYG Advisable?
- How do I add a filter to wp_list_categories() to make links nofollow?
- How to hook into publish post events in wordpress 4.7.5
- What is the best way to embed an JS App in a WordPress Page?
- add_rewrite_rule works in themes function php but when moved into plugin it stops working
- get post attachment using ajax
- Replace default Blogroll Links with Social Media Links
- How to enqueue or include json file to a plugin
- Search and Filter
- Trying to code a simple plugin, infinite loop?
- Update own Plugin Repository on Multisite
- Custom Plugin theme filter
- How to exit a plugin’s execution mid-stream?
- Issue with contextual help overwriting existing content
- Inserting code to HTML view from a pop up initiated from visual view
- CSS not affecting widget output
- Redeclaring a plugin function within a class
- Using a custom shortcode from within the template of a shortcode plugin
- enqueue script/style plungin development
- Trying to get class to instantiate ONCE (or, “why do I keep punching myself in the head?”)
- How to create a WordPress Plugin that has it’s own “page”?
- How to Add a Custom Size for Thumbnails for WP – Gallery
- Create Widget or Enable Shortcodes in Sidebar
- Will I get an error if I try unscheduling a WP Cron scheduled task that wasn’t scheduled?
- Conditional Generation of Image Sizes using add_image_size
- Plugins and caching
- WordPress publish_post hook not getting featured image and meta on first publish, but works on updating title
- Display time difference (6 hours ago) in a Soliloquy caption
- How to add custom view links to wp-admin/post.php?
- Empty Array is Giving Warning for array_merge()
- how to create category with code in wordpress using form
- Get post thumbnail in WP_Query
- Is it possible to have instead mypage.com/?page_id=81 to have mypage.com/cool/?
- User Data Handling between two plugins
- Translations only load from `wp-content/languages/plugins` but not from the plugin’s languages folder
- Woocommerce place order update shipping price
- wp_schedule_event not executing function call, even with add_action
- GET request return value as error instead of success
- How to update global variables in plugin activation callback?
- How to query a nested field in wordpress api using _fields param
- function add custom fields to media gallery
- How to include a page template and template part into my plugin
- ajax response strips multidimensional array and unable to decode
- Multiple instances of $opt_name in redux framework
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- The Events Calendar featured image as body background?
- using wordpress acf shortcods in tables goes outside the table
- Pass javascript result to shortcode executer function
- Not able to Update database while creating a custom module
- How to load css file after a certain css file
- Plugins and how to assign urls to content
- Deactivate Other Incompatible Plugin Upon Activation
- How to make auto installer Plugin?
- Can’t get query string in ajax call
- Cannot echo a JS variable to a jQuery plugin coming from wp_localize_script
- first_name property missing inside register_user action hook
- Pass results of custom query to loop – when writing a plugin
- How do I use (or mimic) document.getElementById() on a page loaded from WordPress database?
- user can login from single account detail from multiple locations(computer) at the same time [closed]
- WP Cron registers hook without any action (does not call the function)
- What’s wrong in the WordPress Meta Box Generator code?
- add category id to option name when adding an option on edit_category
- esc_url, esc_url_raw or sanitize_url?
- React Plugin Settings Page Localization
- Is it within WordPress guidelines to update another plugin’s database fields from my own plugin? [closed]
- Block Development: hamburger module throwing error in save function