Add taxonomy or category slug to custom post types URL

You would do it by assigning the taxonomies when registering the post type: ‘taxonomies’ => [ ‘taxonomy1’, ‘taxonomy2′, ..etc ], https://developer.wordpress.org/reference/functions/register_post_type/#taxonomies https://developer.wordpress.org/reference/functions/register_post_type/#taxonomies-2 You can also use register_taxonomy_for_object_type to do this if you want a function call. You still need to register the taxonomies though or this won’t work. Note that this won’t change your CPT’s … Read more

Select a Text for CSS

Start by creating a stylesheet for your plugin.Then you can use the do_action(‘admin_enqueue_scripts’) to enqueue it in the controlpanel only, avoiding it to be loaded in the frontend. You could do something like this: function my_plugin_admin_styles() { wp_enqueue_style(‘my-plugin-admin-style’, plugin_dir_url(__FILE__) . ‘assets/css/admin-style.css’, array(), ‘1.0.0’, ‘all’); } add_action(‘admin_enqueue_scripts’, ‘my_plugin_admin_styles’); Just make sure to correct the path for … Read more

Remove `View post` Text

I think the issue is this piece of code $messages[‘game’] = $messages[‘post’];. $messages will contains all the updated messages for all custom post type. In this case, your CPT is game, so you should change the array item of game only. The correct code should be public function game_updated_messages( $messages ) { $messages[‘game’][1] = ‘Post … Read more

How can I catch WordPress custom settings page slug has already changed?

you can use the admin_init hook along with the add_query_arg() function to modify the redirection URL for handle the situation. Redirect users to the correct URL admin.php?page=management if they access the settings page with an unexpected slug. Modify the redirection URL after settings have been updated to include the current page slug management, ensuring that … Read more

Using WP_PLUGIN_DIR for include file

It doesn’t make a lot of sense, to me, to say “these should not be used directly by plugins”. I tend to think you should use an available function over the constant – if an available function exists – which, in your case, does not. I would go ahead and use the WP_PLUGIN_DIR constant.

tech