adding an options menu that allows saving multiple sets of said options

here an example of how to manage multiple set of options. it needs to be completed by a nonce to avoid CSRF attack and it needs also a little bit of layout. add_action(“admin_menu”, function () { add_menu_page( “Multioptions” , “Multioptions” , “manage_options” // capability to be allowed to edit options , “MY_PLUGIN__multioptions” , function () … Read more

`post_updated_messages` filter

The function you attach as a filter needs to take in a variable as an argument and return that variable once it’s done processing whatever it is you need it to do. For example: function wpse426272_messages( $messages ) { $messages[‘game’] = array( ‘Game updated’, ‘Game published’, ‘etc’ ); return $messages; } add_filter( ‘post_updated_messages’, ‘wpse426272_messages’ );

How to use native wordpress translation domain inside a custom plugin?

How to use native wordpress translation domain inside a custom plugin? You would use __() without a textdomain, but this won’t work for you because that’s not how post status labels work. get_post_status doesn’t return the name of the post status, it returns a slug, e.g. pending not Pending. The solution is in the user … Read more

Fetch portion of Admin URL

Detecting WordPress admin screens using URL parameters can be a pain in the butt and also raise security issues. However, there’s a whole set of built in functions ready to help… but first off, why are you trying to detect an admin page using a funky string like admin.php?page=my-custom-page is this an admin page? an … Read more

$_GET[”] variable with nonce verification

There are two ways of creating nonce verification for $_GET parameters: If you are coming from a form, you can use the wp_nonce_field function to create your own field. For example: <form action=”edit.php” method=”get”> <input type=”text” name=”example”> ….. <?php wp_nonce_field(‘my_custom_action’, ‘my_custom_name’); ?> <input type=”submit” value=”Submit”> </form> If you are coming from a link you created, … Read more

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