How to enqueue a script on a specific URL that contains multiple parts

is_page() accepts only one optional parameter $page which should be (int|string|array) representing Page ID, title, slug, or array of such. On a standard WP installation your code should look like this. add_action( ‘wp_enqueue_scripts’, ‘enqueue_date_picker_styles_and_scripts’, 101); function enqueue_date_picker_styles_and_scripts() { if ( is_page(‘page-slug-here’) ) { // Replace page-slug-here with slug of page at races/community/add wp_enqueue_style(‘bootstrap-datepicker-css’, ‘//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker.standalone.css’); wp_enqueue_script(‘bootstrap-datepicker-js’, … Read more

permalink not showing correctly using wp_insert_post and post_name

AH! https://permalinkmanager.pro/docs/tutorials/how-to-remove-numbers-2-3-appended-to-the-permalinks/ So the automatic slug creation of -2, -3, ..etc is done by core in order to make slugs unique. But I knew there was a way to change the permalink and not the slug. I just couldn’t find code anywhere to do this so I resorted to using this premium plugin. global $permalink_manager_uris; … Read more

How to 301 redirect from url with post id to permalink with post name (slug)?

yes, it is possible. add a template_redirect hook handler: add_filter(‘template_redirect’, ‘redirect_post_to_canonical_url’); function redirect_post_to_canonical_url(): void { if (!is_single()) { // do not redirect nothing else except posts return; } $canonicalLocation = get_permalink(); $requestUri = $_SERVER[‘REQUEST_URI’]; $currentLocation = home_url(“https://wordpress.stackexchange.com/”) . substr($requestUri, 1); if ($currentLocation === $canonicalLocation) { // prevent from infinite redirect loop return; } wp_redirect($canonicalLocation, 301); … Read more

Make user’s first and last name as user slug

To update existing users, try to make a script file and put that code on it (you have to require necessary file wp-load.php if you put that file in the root of your wp instance) or by listning on a hook like init hook : $blogusers = get_users( ‘role=subscriber’ ); //get users by role // … Read more

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