How to add .html extension only to pages without child pages?

I think you can achieve the desired functionality by selectively adding the .html extension to specific pages using a custom rewrite rule and the page_link filter. // Add a custom rewrite rule to handle pages with .html extension function custom_html_page_rewrite_rule() { add_rewrite_rule( ‘^([^/]+)(\.html)/?$’, ‘index.php?pagename=$matches[1]’, ‘top’ ); } add_action(‘init’, ‘custom_html_page_rewrite_rule’, 10); // Filter page links to … Read more

How to use add_filter to add the extra data to existing array?

The code you provided looks correct, and it should work as expected. However, if you want to add the ‘give_phone’ option using a filter, you would need to modify the code to include the filter hook and the callback function. Here’s the modified code: function additional_field($options) { $options[‘give_phone’] = __( ‘Phone’, ‘give’ ); return $options; … Read more