I haven’t got enough points to comment a link and I don’t wish to plagiarise the answer from another website, but I hope this helps
add_action( 'publish_post', 'update_txt_file' );
add_action( 'publish_page', 'update_txt_file' );
Reference: https://wpza.net/wordpress-setup/how-to-update-a-file-after-new-post-or-page-in-wordpress/
Related Posts:
- Best collection of code for your 'functions.php' file [closed]
- Manually set global $post vars with an ID, in order to use template tags
- How to include a plugin’s php file to another plugin functions file [duplicate]
- Limit access to posts/pages by user roles
- Remove Google Fonts Which Are (Probably) Added By Plugins
- if plugin is active? check if plugin is enabled or not?
- Common functionality between my own plugins
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- How to override a theme function (within a class) using a plugin
- Seeking clarification on page request life-cycle
- How to assign user a role if none is present when logging in
- Saving Plugin settings to the database
- How to remove action from plugin?
- How to find out what blocks are added by a plugin
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- plugin development: problem with functions
- AJAX button run function
- Dropdown menu on custom page with product to choose number of products per page
- How to append to title via functions.php for auto-posting plugin [duplicate]
- Bootstrap Drop Down menu is not working
- Custom random quote widget breaks when used in multiple sidebars
- Display post lists in 2nd paragraph
- How to change constants in WordPress wp-config.php programmatically?
- Override Plugin Script Fucnction in WordPress
- How to display custom sidebar in wordpress 5.5.2
- Replacing a plugin function with a custom renamed function doesn’t work
- How to call WordPress function other files
- Conditional attributes and logic per product category
- Ajax : Call undefined function plugin_function() … can’t call any plugin function
- bbPress plugin: forum lists not showing in correct order? [closed]
- What is @Action in WordPress?
- Is there a best practice remediation for PhpStorm’s warning that void function the_post_thumbnail is used?
- How to over-ride a file in a plugin? [closed]
- Overwrite category head title
- execute function after one completed
- WordPress checkbox and Illegal string offset
- Undefined index: action plugin problem
- PHP script from functions php is loaded via admin-ajax to div…and the result is 0, not the desired content
- How to reset the plugins without deactivate the plugin
- plugins_url() works everywhere but wp_reqister_script()
- Replacing global wp_query
- How to get specific string/value from an array? php [closed]
- WordPress Stock Update Programatically
- 5 PHP Fatal error: Uncaught ArgumentCountError (Cannot Find)
- How can I fetch data from another website to my wordpress website with mysql database
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- how to change wp-admin url using function file
- same user role or copy the user role to be same as the other role
- Changing plugin options from theme functions file?
- Expected ‘add_filter’ (T_STRING)
- Execute a function when the entire page is displayed
- How can i listing current category and Featured Category post list?
- How to add custom function to pluggable.php
- Adding a pagenavi to function for displaying bookmarks
- grab or load text on demand
- sliding/fading header plugin or approach suggestion
- What is the most efficient way of adding additional functionaliy for admin only
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- Replace the_content with ACF Flexible Content via function
- How would I get the new plugin version on this function?
- Cannot pass value variable to WP AJAX functions
- Sharing varible between two add_actions
- Search in WordPress
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- post id or permalink auto-incrementing number and reset everyday
- Modify function output in a plugin
- Is admin section completely customizable in terms of styling?
- How to make the first letter of a post title uppercase, in a plugin?
- Get a Taxonomy values in an array
- Update (a function) post’s featured image as soon as $image_url changes
- Shows warning when enable “wp_gallery_custom_links” plugin with Themify Builder
- WordPress environment not loading properly
- Place content inside the Post Loop
- How to replace native comment_count with Comments Evolved aggregate count
- Why isn’t my plugin seeing other classes?
- Follow author on muti-user WordPress site
- Hook into install email
- wordpress Shortocode running twice?
- Is there any wordpress function to update a random post every 10 minutes?
- Calling an custom field from theme option at the frontend
- pluggable function in theme, to be overridden by plugin
- Calling a function from a link in WordPress
- Saving an array to get_options
- functions.php conditional output for a single plugin
- Showing author box on post detail page
- Single dash converted to double dash
- add query string to all pages after user logged in
- How use Dynamic hyperlink on each wordpress post?
- Simple WordPress function / plugin to redirect a site
- Remove base from the custom post type URL [duplicate]
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- Requires PHP version 5.3.0
- Can’t modify plugin function
- Show WooCommerce products based on query parameters on redirect
- wp_enqueue_script doesn’t load JS in plugin
- Read page- or post-content across different builder-plugins
- Remove posts that start with similar words (like a delete duplicate posts plugin)
- Secure way to add JS Script to WordPress filesystem
- How to get next day date of a specific day
- How to access a function declared in child theme’s functions file in a plugin file?