You are underestimating the complexity of robots file handling in WordPress. The presence of physical file is one of two cases.
If physical file is not present during template load is_robots()
checks is performed and in positive case do_robots()
runs, generating and serving the “file” on the fly.
Just going ahead and creating robots.txt
in arbitrary site might very well wreck havoc with related code that is making use of virtual file and hooks in it.
Answering direct question — I am not sure which goals you are pursuing by this functionality so it is a little hard to tell what would work best for timing. The simples might be to run it on visiting theme’s options page (in same way as visiting native permalink settings performs permalink flush).
Related Posts:
- get_option() vs get_theme_mod(): Why is one slower?
- Using update_option() and get_option() is echoing escaped strings
- Theme Options page with tabs
- Outputting results from select box option in options panel
- Display user HTML on website
- Need help understanding/coding with Settings API
- get option framework options returns Call to undefined function of_get_option()
- How to set a default theme option after installing theme?
- WordPress theme options framework, I can’t read them in my templates
- Multiple options in the options_value field of the wp_options table
- Theme options are they necessary
- How do I display a WP Option from an array?
- Blogname and Blogdescription in Pagelines DMS Options Panel
- What should I use to store options for a single blog on a network site?
- Delete Transient when clicking ‘Save Changes’ on options page
- Changing the layout of a custom options page
- Slightly modified options framework Colour picker
- wordpress theme option in other templates
- wp_editor() fields on Theme Options Page not saving
- Adding a checkbox to the theme customizer
- Adding a description to theme customizer controls
- How To Add New Option Types To Option Tree?
- Best practices for a Style/CSS based theme options page?
- Theme Options Panels, What are some good examples from Frameworks or Premium Themes? [closed]
- Submenu pages delete settings from options array when saved
- Site Title and Tagline in Theme Options Page
- Where are a theme’s options stored and can I export them to be imported into freshly installed themes?
- Can I install Analytics before deciding on a theme?
- Options Framework options not being output
- Editor role cannot save custom theme options
- Two Ways Of Creating WordPress Options Pages
- WordPress Nonce and check admin referer help needed
- Theme option : having the ability to select among several predefined headers
- Site Title and Tagline in Pagelines DMS Options Panel
- Upload multiple images via theme options [closed]
- Save Theme Options (options.php) From The Frontend
- Separate backend “Widgets” page for each language
- PHP stylesheet cannot use standard WP functions
- Setting up a members area
- Theme options WP Editor
- WordPress: update_option, don’t update empty options?
- How to mark an option as selected
- Cannot update WordPress General Settings Site Title and Tagline
- Is there a reliable way to keep track of how long a WordPress theme has been active?
- Can’t save options
- How to create dependent field in Customizer?
- How can I insert some extra validation into the theme options’ validation function using add_filter?
- How to add an alternative style sheet as a theme option?
- Disable image resizing on specific upload fields
- Put standard wordpress options into a theme options panel?
- How can I get my options in json response?
- Removing \\\ from Saved Data
- Use of check_admin_referer with theme options and options.php
- WordPress custom options storing?
- Add Plugin options as subpage to Theme options page
- How can I make my options in an array and store theme in WP options one DB row?
- WordPress admin panel framework weird layout on server side
- Update problem with update_option() in combination with register_setting()
- Theme Customizier sanitize_callback not working
- Getting the ID of header image, even when set to random
- Theme Options page not saving data correctly
- Getting error to display radio button value in General Settings page
- Error: options page not found
- Create an Options page with two image upload fields
- Only allow site url in text field using wp_kses/wp_filter_nohtml_kses?
- Additional custom header image
- Efficiency of wp_options vs a new table
- Options Theme – WordPress [closed]
- How to reset (clear) theme settings
- Settings API settings section not appearing
- Is there a function to add additional options to the Twentyeleven option page?
- How to save custom settings api fields with custom section fuction
- How to get of_get_option() inside the inc folder file
- Retrieve uploaded image attibutes value from option tree theme options
- Warning: Illegal string offset on theme options page [closed]
- Issue on Checkbox with Custom Option Page
- Passing dynamic options from backend to frontend
- Link blogname and blogdescription to the Options Framework
- Display and hide content using checkbox in Options Framework Theme
- How do I remove the page listing menu in the header in the Twenty Ten Theme?
- My title won’t update
- Shorter admin url for options page
- not getting API setting saved confirmation message after update on option page
- How to use WP Theme Option: Custom_Backgrounds on specific element?
- WP Page Options Array
- How can I create a rearrangeable list of items like OptionTree offers with the Theme Customization API?
- WordPress Theme Settings Page
- Bring page from sub menu to admin menu in option tree
- Adding a theme option to the admin that lets me turn on/off a javascript file
- Update Specific Key Value in Complex `wp_options` object
- Can Settings API setting generate other settings?
- How to load dynamic option with ajax
- Cannot modify headers
- How to get functions.php to talk to options.php
- Options Framework not saving options correctly
- How to use checked() function with multiple check box group? How to properly sanitize that checkbox group?
- Admin menus and submenus
- Theme Options Page – Select, Radio, Tabs
- WordPress Options Framework, add to main menu not appearance menu
- Tabbed theme options query about add_settings_section callback function