How can I make it so the Add New Post page has Visibility set to Private by default?

since you’re developing a plug-in, I assume you don’t want to touch any files outside of wp-content/plugins or ../themes for that matter. However, if that’s not the case, follow along: Go to wp-admin/includes/meta-boxes.php and find: $visibility = ‘public’; $visibility_trans = __(‘Public’); Now change it to the obvious: $visibility = ‘private’; $visibility_trans = __(‘Private’); Again, this … Read more

Is it worth checking if class_exists when developing a plugin and how to do it?

Use an auto-loader and let PHP resolve that problem for you. Then only one class will be loaded, and you don’t have to worry about doubled declarations. Example I have an (unfinished) plugin Post Notes with the following file structure: – plugin.php – php/ – Nonce_Validator.php – Save_Post_Request_Validator.php – Textarea.php – … and more This … Read more

Loading external page template and enqueue script from plugin causes 403 forbidden error

Your CODE is fine, the reason you are getting 403 error is because $_SERVER[‘DOCUMENT_ROOT’] returns absolute PATH to your web root, not URL. JavaScript needs to be added as URL. So, you may use Load_Template_Scripts_wpa83855 function in your plugin and then use: wp_enqueue_script( ‘wtd’, plugins_url( ‘/js/wtd.js’ , __FILE__ ) ); CODE to add JavaScript. Note: … Read more

register_uninstall_hook() vs uninstall.php – which one is better way to handle plugin uninstallation script?

The benefit of uninstall.php, and the reason that it was introduced, is that it allows you to isolate your uninstallation code from the rest of your plugin’s code. This means that your entire plugin doesn’t have to be loaded when it is uninstalled. That minimizes the chance that your plugin will inadvertently run code during … Read more

How to properly validate data from $_GET or $_REQUEST using WordPress functions?

WordPress doesn’t provide any specific data validation functions for SUPERGLOBALS. I use the PHP filter_input function then escape it as I would any untrusted variable. $url = filter_input( INPUT_GET, ‘some_query_string’, FILTER_VALIDATE_URL ); echo ‘<a href=”‘. esc_url( $url ). ‘”>Click Me</a>’; The PHP filter input accepts: Validate filters Sanitize filters Other filters Additional Filter flags

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)