Removing Visual Composer head meta (works alone but not with IF)

your problem boils down to doing things before the init hook was fired. You should never check for code existence, DB structure before it. In case of frontend related code you should not do anything before template_redirect hook. Your code should be like add_action(‘wp_head’, ‘myoverride’, 1); function myoverride() { if ( class_exists( ‘Vc_Manager’ ) ) … Read more

Remove meta description on certain pages

You should be able to remove the existing description tag with the following code: remove_action( ‘wp_head’, ‘_wp_render_title_tag’, 1 ); Put the above snippet inside the same function you are using to conditionally add a new tag so there is always only a single description tag at a time.

Modifying meta tags after doing ajax call in plugin

It took me a while of tinkering with the hooks, but in the end, I fixed it by loading the post earlier. Instead of loop_start: $this->loader->add_action(‘loop_start’, $plugin_public, ‘mp_display_post’); I used get_header: $this->loader->add_action(‘get_header’, $plugin_public, ‘mp_display_post’); This worked properly because now the post information is loaded before wp_head gets called, and therefore I can use the loaded … Read more

Custom plugin – $post_id in wp_head

Use get_queried_object_id() to get the post ID of the current page/post when viewing a single page or post, regardless of whether or not you’re in the loop, or what the global $post variable happens to be at that moment: if ( is_page() || is_single() ) { $post_id = get_queried_object_id(); $meta_alternate = get_post_meta( $post_id, ‘extra_meta_alternate’, true … Read more

adding meta data using plugin to top of head

Okay, here’s the answer: function CustomHead() { include(‘headcontent.php’); } add_action(‘wp_head’,’CustomHead’,1,1); The key is that first “1”, which sets the priority of it to run at the highest (this is an optional element, defaulting to 10, putting it at the end of the head by default). More info here: http://codex.wordpress.org/Function_Reference/add_action

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