wp_get_canonical_url showing first url of the post for custom page

This is because wp_get_canonical_url can only be used on posts, and cannot be used for tags authors archives etc. Returns the canonical URL for a post. https://developer.wordpress.org/reference/functions/wp_get_canonical_url/ More specifically, no equivalent exists for tag archives because archives and listings do not have canonical URLs. A canonical URL indicates to a search engine the correct and … Read more

Adding a H1 Tag to Post Tags automatically, but hide the tag? (Same for Category)

Create custom action in function.php, which checks current page type (if it’s category or tag page). function hidden_term_name_action() { if( is_category() || is_tag() ){ $term_id = get_queried_object_id(); $term = get_term($term_id); if($term){ echo sprintf(‘<h1 style=”display:none;”>%s</h1>’, esc_attr($term->name)); } } } add_action(‘hidden_term_name’, ‘hidden_term_name_action’); Paste this code in header.php, which fires this action and pastes term title inside hidden … Read more

How to add a rest field to post tags?

OK finally found the solution. After looking in wp_term_taxonomy table, I noticed that taxonomy column describes the taxonomy term for tags – which is actually post_tag, not just ‘tag’. So, this works: add_filter(‘rest_prepare_post_tag’, ‘wp_api_encode_yoast’, 10, 3); Hopefully someone will be helped by this.

Yoast primary category query modification

I’m not sure this will fix it, but maybe try using the current category slug for the $current_category variable, instead of single_cat_title(), like so: $term = get_queried_object(); $current_category = $term->slug; This might help because the category_name parameter in WP_Query, despite its name, should be the term slug. single_cat_title() returns the displayed category title, not slug.

Yoast taking over my WordPress title tag [closed]

That’s not what the SEO title does/is for. It appears that you’ve used the wp_title() function in your template by mistake. wp_title() is intended for use in the <title> tag in the <head> for setting the browser tab/document title. However, since WordPress 4.1 this has been superseded (but not officially deprecated, yet) by add_theme_support( ‘title-tag’ … Read more

Conflict calling an add_filter() twice

Filters get queued and sorted by priority, then order of occurrence. Filters’ default priority is 10, unless otherwise specified. The order of occurrence can be affected by the order plugins get fired (alphabetical, by plugin name). So, when you started poking at this, both filters had equal priority. That would mean a rather arbitrary factor … Read more

wp-admin send 404 error

…what @sally_CJ said in the comment to your question. In general, if a plugin is causing problems, then remove the plugin. If you can’t do that with admin/plugins, then use your hosting File Manager or FTP to rename that plugin’s folder, which will effectively disable it. Also, ensure that PHP is at least version 7.2, … Read more

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