WordPress: Remove application/ld+json from head tag - wordpress

How to remove script tag shown bellow from the wordpress page using php or javascript.
<script type="application/ld+json">{"#context":"http:\/\/schema.org","#type":"BlogPosting","mainEntityOfPage":"http:\/\/domain.com\/190415-%d8%a5%d8%b0%d8%a7-%d9%83%d9%86%d8%aa-%d8%aa%d9%86%d9%88%d9%8a-%d8%b2%d9%8a%d8%a7%d8%b1%d8%a9-%d8%a3%d9%88%d8%b1%d9%88%d8%a8%d8%a7-%d9%87%d8%b0%d8%a7-%d8%a7%d9%84%d8%b5%d9%8a%d9%81%d8%8c-%d8%ad%d8%b3%d8%a7%d8%a8%d8%a7%d8%aa-%d8%a7%d9%86%d8%b3%d8%aa%d9%82%d8%b1%d8%a7%d9%85-%d9%87%d8%b0%d9%87-%d8%b3%d8%aa%d9%83%d9%88%d9%86-%d8%af%d9%84%d9%8a%d9%84%d9%83\/","publisher":{"#type":"Organization","name":"\u0634\u0628\u0643\u0629 \u0623\u0628\u0648 \u0646\u0648\u0627\u0641","logo":{"#type":"ImageObject","url":"http:\/\/domain.com\/wp-content\/uploads\/2016\/02\/favicon.png","height":32,"width":32}},"headline":"\u0625\u0630\u0627 \u0643\u0646\u062a \u062a\u0646\u0648\u064a \u0632\u064a\u0627\u0631\u0629 \u0623\u0648\u0631\u0648\u0628\u0627 \u060c \u062d\u0633\u0627\u0628\u0627\u062a \u0627\u0646\u0633\u062a\u0642\u0631\u0627\u0645 \u0633\u062a\u0643\u0648\u0646 \u062f\u0644\u064a\u0644\u0643","datePublished":"2015-04-20T19:14:41+00:00","dateModified":"2016-02-01T11:12:42+00:00","author":{"#type":"Person","name":"\u0645\u062d\u0631\u0631\u0661"},"image":{"#type":"ImageObject","url":"http:\/\/domain.com\/wp-content\/uploads\/2015\/04\/Europ.jpg","width":950,"height":534}}</script>
From Head tag.
How can do that

Depends on where the tag gets injected. Check you header.php file in Theme directory, if it's not the one, try disabling all plugins one by one to see which one adds that tag.

Related

Wordpress add Google tag manager script to header.php

The Google tag manager requires me to put one script inside the "head" tag and one at the beginning of the "body" tag.
I want to know what would be considered "best practise" to achieve this.
Are there any other ways than to create a child theme and place the Script in the header.php file?
You can use this plugin for GTM and other scripts:
https://wordpress.org/plugins/duracelltomi-google-tag-manager/
You can use "Insert Headers and Footers by WPBeginner" plugin
https://wordpress.org/plugins/insert-headers-and-footers/

how do i locate files in wordpress by inspecting element a particular element in google chrome?

I want to change some particular line on my Wordpress site which I cannot change in the customization. How do I locate a certain line with inspect element in chrome?
My website is www.Artiana.io and I want to edit this line:
"<h5 class="subscribe-description">Learn more</h5>"
Please, can anyone help me out?
Let me show you how you can use WordPress's hints in html body class to find the php file:
WordPress gives hint in the HTML's body tag that which particular template was used to display this page.
In your case we have following classes in the body tag:
<body class="home page-template page-template-page-templates page-template-page_front-page page-template-page-templatespage_front-page-php page page-id-466 custom-background wp-custom-logo blog-post">
Now there is a specific class which ends with php, which tells that template was used by your theme to build this page. i.e. page-template-page-templatespage_front-page-php
Now it could mean that in your theme folder:
/wp-content/themes/hestia/
There could be sub folder or folders called: **page-template/page-templates** and inside it is page_front-page.php PHP file, which is being used to create this layout. See if you can locate the code you are trying to modify there.

Including CSS in my plugin shows up in source but does not apply to my elements

I'm including a .css file in my plugin and the files show up on my page and I can see the path and click through the path to see the raw .css content. However, It is not applying to my HTML elements.
I removed the wp_enqueue_style() that included my CSS file in my plugin and placed the code in my theme's custom CSS template I'm using (just the raw css) and refresh and that works; the CSS is applied to my HTML elements as expected.
One thing to note is that in the same plugin I'm returning HTML that I want this CSS to be applying to through a shortcode on a page.
Is it something with the CSS not being registered/applied in time to pick up or find the elements if it's adding from a plugin? I need the CSS to be added from the plugin and not from the theme's template. Is there something I'm missing?
Thanks!
I figured out my own problem.
My plugin code was:
wp_enqueue_style('nbfx-fs-css', plugins_url('/assets/css/nbfx-fs.css', __FILE__), array(), null, true);
I took a look at my HTML source and found this:
<link rel='stylesheet' id='nbfx-fs-css-css' href='MY-CORRECT-CSS-FILE-PATH' type='text/css' media='1' />
And I noticed the media='1'. So apparently I need to leave the 4th parameter blank or provide 'all'.
I hope this helps someone else who copy and paste the wp_enqueue_style() function with set parameters from someone else.

Custom WordPress Theme isn't picking up the style.css file

I have just followed a tutorial about creating custom WordPress theme, each and everything went just fine from static to dynamic conversion but when I activate that theme and I come up with a plain HTML document with blue hyperlinks which mean the site is not picking up the css file of style.css
Am I doing something wrong? Please help me.
Check your source HTML and see that the path to your CSS is correct.
You can use bloginfo() to find the correct path by using:
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/style.css">
If your style.css resides in the root folder of your template.
Where did you add the link to the file? - View the source of the page to see if the link is there and try navigating to it to see if it returns a 404 (Not Found) or other error.
My preferred way to include theme stylesheets is adding something like this to my functions.php.
add_action('wp_enqueue_scripts','enqueue_my_styles_scripts');
function enqueue_my_styles_scripts() {
wp_enqueue_style('my-styles',get_stylesheet_directory_uri().'/style.css');
}
Check out wp_enqueue_style and make sure you have a wp_head() call in your header file

insert in the head tag after wp_head

Using wordpress 2.9.2. I am loading my css files for plugins as they are being called, which ofcourse is after my header has been loaded. I want to insert the calls those css files in the HEAD tag of the page, which can be done if i get a hook which includes lines in the head after wp_head() has been called. Help !
Look at http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head - the action is called wp_head.
You will want to use wp_register_style() to register your CSS file followed by wp_enqueue_style() to actually add it to the list of stylesheets that are output.
There is an example on that page, but replace 'wp_print_styles' in the example with 'wp_head'.
Have you tried echoing the styles or .css include the in a function passed into wp_print_styles API action hook?
If you are using your own theme, you can just put <style> tags in your header.php file pointing to the stylesheets you are using.
If you need a hook, it is called wp_head (check the Codex documentation on it).
The solution that worked for me was inserting the css files in head using output buffer.

Resources