• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Help needed in Wordpress Automatic Plugin

Iron-Man

Active member
Babiato Lover
Oct 9, 2019
331
88
28
29
India
Anyone using wp automatic plugin, I need your help. Also anyone with some wordpress coding knowledge can help me here.

While scrapping a post from another website, I want to fetch meta description of that post and add them in my post content. In the plugin setting I can't find any option.

There is an option to fetch meta description and add them in Yoast meta box. This is the author's documentation link: http://valvepress.com/how-to-automa...on-like-the-source-using-wordpress-automatic/

This is working fine. When I add this code " regex|<meta name="description" content="(.*?)"|_yoast_wpseo_metadesc " under the setting "Specific extraction to a custom field, excerpt, tags or custom taxonomy ", meta descriptions are automatically saved inside yoast meta box.

In plugin's setting it says, to use this feature, follow this rule: "extractionMethod|data|customFieldName" . So I tried this hoping it will work: regex|<meta name="description" content="(.*?)"|post_content , bu this did not worked.

Also there is an option "Add custom fields/Taxonomies to the posts". But here too I am unable to do anything.

SO anyone using wp automatic or have some code knowledge, plz help me. Thanks in advance.
 
Anyone using wp automatic plugin, I need your help. Also anyone with some wordpress coding knowledge can help me here.

While scrapping a post from another website, I want to fetch meta description of that post and add them in my post content. In the plugin setting I can't find any option.

There is an option to fetch meta description and add them in Yoast meta box. This is the author's documentation link: http://valvepress.com/how-to-automa...on-like-the-source-using-wordpress-automatic/

This is working fine. When I add this code " regex|<meta name="description" content="(.*?)"|_yoast_wpseo_metadesc " under the setting "Specific extraction to a custom field, excerpt, tags or custom taxonomy ", meta descriptions are automatically saved inside yoast meta box.

In plugin's setting it says, to use this feature, follow this rule: "extractionMethod|data|customFieldName" . So I tried this hoping it will work: regex|<meta name="description" content="(.*?)"|post_content , bu this did not worked.

Also there is an option "Add custom fields/Taxonomies to the posts". But here too I am unable to do anything.

SO anyone using wp automatic or have some code knowledge, plz help me. Thanks in advance.

*note : im using wp automatic v 3.50.3
you must edit file plugins/wp-automatic/core.php
-first find this code
PHP:
// Feeds part to field extraction set
            if ($camp_type == 'Feeds') {
            
                $customFieldsArr = $img ['custom_fields'];
            
                if (is_array ( $customFieldsArr ) && count ( $customFieldsArr ) != 0) {
                
                    foreach ( $customFieldsArr as $customFieldSet ) {
                    
                        if ($customFieldSet [0] == 'excerpt') {
                            $my_post = array (
                                    'ID' => $id,
                                    'post_excerpt' => $customFieldSet [1]
                            );
                        
                            wp_update_post ( $my_post );
                        } elseif ($customFieldSet [0] == 'tags') {
                        
                            if (in_array ( 'OPT_TAXONOMY_TAG', $camp_opt )) {
                                wp_set_post_terms ( $id, $customFieldSet [1], trim ( $camp_general ['cg_tag_tax'] ), true );
                            } else {
                                wp_set_post_tags ( $id, $customFieldSet [1], true );
                            }
                        } elseif (stristr ( $customFieldSet [0], 'taxonomy_' )) {
                        
                            wp_set_post_terms ( $id, $customFieldSet [1], str_replace ( 'taxonomy_', '', $customFieldSet [0] ), true );
                        } else {
                            add_post_meta ( $id, $customFieldSet [0], $customFieldSet [1] );
                        }
                    } // foreach field
                } // if array
            } // if feed

- and replace with this code

PHP:
// Feeds part to field extraction set
            if ($camp_type == 'Feeds') {
            
                $customFieldsArr = $img ['custom_fields'];
            
                if (is_array ( $customFieldsArr ) && count ( $customFieldsArr ) != 0) {
                
                    foreach ( $customFieldsArr as $customFieldSet ) {
                    
                        if ($customFieldSet [0] == 'excerpt') {
                            $my_post = array (
                                    'ID' => $id,
                                    'post_excerpt' => $customFieldSet [1]
                            );
                        
                            wp_update_post ( $my_post );
                        } elseif ($customFieldSet [0] == 'tags') {
                        
                            if (in_array ( 'OPT_TAXONOMY_TAG', $camp_opt )) {
                                wp_set_post_terms ( $id, $customFieldSet [1], trim ( $camp_general ['cg_tag_tax'] ), true );
                            } else {
                                wp_set_post_tags ( $id, $customFieldSet [1], true );
                            }
                        } elseif (stristr ( $customFieldSet [0], 'taxonomy_' )) {
                        
                            wp_set_post_terms ( $id, $customFieldSet [1], str_replace ( 'taxonomy_', '', $customFieldSet [0] ), true );
                    
                        }elseif( $customFieldSet[0] == 'to_post_content'){
                                $my_post = array(
                                    'ID' => $id,
                                    'post_content' => '<span class="meta-description">'.$customFieldSet[1].'</span>'.$abcont
                                );
                                 wp_update_post( $my_post );
                        } else {
                            add_post_meta ( $id, $customFieldSet [0], $customFieldSet [1] );
                        }
                    } // foreach field
                } // if array
            } // if feed
- put this command into "Specific extraction to a custom field, excerpt, tags or custom taxonomy"
from meta description
regex|<meta name="description" content="(.*?)"|to_post_content

or from og:description
regex|<meta property="og:description" content="(.*?)"|to_post_content
 
Last edited:
*note : im using wp automatic v 3.50.3
you must edit file plugins/wp-automatic/core.php
-first find this code
PHP:
// Feeds part to field extraction set
            if ($camp_type == 'Feeds') {
          
                $customFieldsArr = $img ['custom_fields'];
          
                if (is_array ( $customFieldsArr ) && count ( $customFieldsArr ) != 0) {
              
                    foreach ( $customFieldsArr as $customFieldSet ) {
                  
                        if ($customFieldSet [0] == 'excerpt') {
                            $my_post = array (
                                    'ID' => $id,
                                    'post_excerpt' => $customFieldSet [1]
                            );
                      
                            wp_update_post ( $my_post );
                        } elseif ($customFieldSet [0] == 'tags') {
                      
                            if (in_array ( 'OPT_TAXONOMY_TAG', $camp_opt )) {
                                wp_set_post_terms ( $id, $customFieldSet [1], trim ( $camp_general ['cg_tag_tax'] ), true );
                            } else {
                                wp_set_post_tags ( $id, $customFieldSet [1], true );
                            }
                        } elseif (stristr ( $customFieldSet [0], 'taxonomy_' )) {
                      
                            wp_set_post_terms ( $id, $customFieldSet [1], str_replace ( 'taxonomy_', '', $customFieldSet [0] ), true );
                        } else {
                            add_post_meta ( $id, $customFieldSet [0], $customFieldSet [1] );
                        }
                    } // foreach field
                } // if array
            } // if feed

- and replace with this code

PHP:
// Feeds part to field extraction set
            if ($camp_type == 'Feeds') {
          
                $customFieldsArr = $img ['custom_fields'];
          
                if (is_array ( $customFieldsArr ) && count ( $customFieldsArr ) != 0) {
              
                    foreach ( $customFieldsArr as $customFieldSet ) {
                  
                        if ($customFieldSet [0] == 'excerpt') {
                            $my_post = array (
                                    'ID' => $id,
                                    'post_excerpt' => $customFieldSet [1]
                            );
                      
                            wp_update_post ( $my_post );
                        } elseif ($customFieldSet [0] == 'tags') {
                      
                            if (in_array ( 'OPT_TAXONOMY_TAG', $camp_opt )) {
                                wp_set_post_terms ( $id, $customFieldSet [1], trim ( $camp_general ['cg_tag_tax'] ), true );
                            } else {
                                wp_set_post_tags ( $id, $customFieldSet [1], true );
                            }
                        } elseif (stristr ( $customFieldSet [0], 'taxonomy_' )) {
                      
                            wp_set_post_terms ( $id, $customFieldSet [1], str_replace ( 'taxonomy_', '', $customFieldSet [0] ), true );
                  
                        }elseif( $customFieldSet[0] == 'to_post_content'){
                                $my_post = array(
                                    'ID' => $id,
                                    'post_content' => '<span class="meta-description">'.$customFieldSet[1].'</span>'.$abcont
                                );
                                 wp_update_post( $my_post );
                        } else {
                            add_post_meta ( $id, $customFieldSet [0], $customFieldSet [1] );
                        }
                    } // foreach field
                } // if array
            } // if feed
- put this command into "Specific extraction to a custom field, excerpt, tags or custom taxonomy"
from meta description
regex|<meta name="description" content="(.*?)"|to_post_content

or from og:description
regex|<meta property="og:description" content="(.*?)"|to_post_content

Thanks for helping me. But unfortunately this is not working. I followed what you said. But this is not fetching the meta description (the short description which I want), rather the whole content.

I followed your advice by using wp automatic v 3.50.3, still same issue. It is fetching the full content.

For testing, I am trying to fetch this url: https://www.everydayhealth.com/coro...ay-affect-your-covid-19-risk-studies-suggest/ and I want only this information as shown below in the image.

1599505862921.png
 
Last edited:
Thanks for helping me. But unfortunately this is not working. I followed what you said. But this is not fetching the meta description (the short description which I want), rather the whole content.

I followed your advice by using wp automatic v 3.50.3, still same issue. It is fetching the full content.

For testing, I am trying to fetch this url: https://www.everydayhealth.com/coro...ay-affect-your-covid-19-risk-studies-suggest/ and I want only this information as shown below in the image.

1599505862921.png
What type of campaign do you use?
because the code I provide above is only for the campaign type : feed and multi-page-scraper

do you just want to take the meta description from that web and just put the meta description into your post content?
if it's like that then
PHP:
//change this code

$my_post = array(

'ID' => $id,

'post_content' => '<span class="meta-description">'.$customFieldSet[1].'</span>'.$abcont

);


//replace with this

$my_post = array(

'ID' => $id,

'post_content' => $customFieldSet[1]

);

Now the content from your post will only contains data from the meta description and not the full content.


*the proof is as shown below
fetch from https://www.everydayhealth.com/coro...increase-the-risk-for-covid-19-complications/
3.png


-after fetching
4.png


-inside post, the content will be like this.

1.png


regex|<meta property="og:description" content="(.*?)"|to_post_content
2.png
 
Last edited:
What type of campaign do you use?
because the code I provide above is only for the campaign type : feed and multi-page-scraper

do you just want to take the meta description from that web and just put the meta description into your post content?
if it's like that then
PHP:
//change this code

$my_post = array(

'ID' => $id,

'post_content' => '<span class="meta-description">'.$customFieldSet[1].'</span>'.$abcont

);


//replace with this

$my_post = array(

'ID' => $id,

'post_content' => $customFieldSet[1]

);

Now the content from your post will only contains data from the meta description and not the full content.


*the proof is as shown below
fetch from https://www.everydayhealth.com/coro...increase-the-risk-for-covid-19-complications/
3.png


-after fetching
4.png


-inside post, the content will be like this.

1.png


regex|<meta property="og:description" content="(.*?)"|to_post_content
2.png

Thanks, it is working fine. I am using multi page scrapper campaign. Now I am able to fetch the meta descriptions. But I have encounter another problem after this. Now the post text template is not working at all.

I am describing my issue clearly. I am using bimber theme and using its custom post "link" format. Here after giving only a single link in a post, it looks like this.

aaa.JPG


In bimber, it has its own link fetching system, where after fetching a link, it looks like this:

asdfg.JPG

Here it fetch the link & meta description only. But as bimber have no bulk fetching or automation feature, I am using wp automatic.

After using your given code, I am able to fetch meta descriptions, but unable to fetch the source link. After changing core files like you said, I found out that the post text template is not working if I try to fetch meta description by using the setting "Specific extraction to a custom field, excerpt, tags or custom taxonomy" like you said.


I am using this code in my post text template " <br><a href="[source_link]">Source link </a>" to fetch only the source link of a post from another website.

ddd.JPG


I tried to use other supported tags their, but nothing worked, only the meta descriptions is fetched.

I only need 2 data in my post: meta description & the source link. I guess if the post text template works correctly, I can achieve this.
 

Attachments

  • aaa.JPG
    aaa.JPG
    64.2 KB · Views: 2
Thanks, it is working fine. I am using multi page scrapper campaign. Now I am able to fetch the meta descriptions. But I have encounter another problem after this. Now the post text template is not working at all.

I am describing my issue clearly. I am using bimber theme and using its custom post "link" format. Here after giving only a single link in a post, it looks like this.

aaa.JPG


In bimber, it has its own link fetching system, where after fetching a link, it looks like this:

asdfg.JPG

Here it fetch the link & meta description only. But as bimber have no bulk fetching or automation feature, I am using wp automatic.

After using your given code, I am able to fetch meta descriptions, but unable to fetch the source link. After changing core files like you said, I found out that the post text template is not working if I try to fetch meta description by using the setting "Specific extraction to a custom field, excerpt, tags or custom taxonomy" like you said.


I am using this code in my post text template " <br><a href="[source_link]">Source link </a>" to fetch only the source link of a post from another website.

ddd.JPG


I tried to use other supported tags their, but nothing worked, only the meta descriptions is fetched.

I only need 2 data in my post: meta description & the source link. I guess if the post text template works correctly, I can achieve this.

well just add new condition to php code
PHP:
//replace the code that I provide above with the code below

// Feeds part to field extraction set
            if ($camp_type == 'Feeds') {
           
                $customFieldsArr = $img ['custom_fields'];
           
                if (is_array ( $customFieldsArr ) && count ( $customFieldsArr ) != 0) {
               
                    foreach ( $customFieldsArr as $customFieldSet ) {
                   
                        if ($customFieldSet [0] == 'excerpt') {
                            $my_post = array (
                                    'ID' => $id,
                                    'post_excerpt' => $customFieldSet [1]
                            );
                       
                            wp_update_post ( $my_post );
                        } elseif ($customFieldSet [0] == 'tags') {
                       
                            if (in_array ( 'OPT_TAXONOMY_TAG', $camp_opt )) {
                                wp_set_post_terms ( $id, $customFieldSet [1], trim ( $camp_general ['cg_tag_tax'] ), true );
                            } else {
                                wp_set_post_tags ( $id, $customFieldSet [1], true );
                            }
                        } elseif (stristr ( $customFieldSet [0], 'taxonomy_' )) {
                       
                            wp_set_post_terms ( $id, $customFieldSet [1], str_replace ( 'taxonomy_', '', $customFieldSet [0] ), true );
                        }elseif( $customFieldSet[0] == 'to_post_content'){
                               
                                    $my_post = array(
                                                'ID' => $id,
                                                'post_content' => $customFieldSet[1]
                                    );

                                    wp_update_post( $my_post );
                               
                        }elseif( $customFieldSet[0] == 'to_post_content_with_source_link'){
                                //this html format for bimbel theme, or adjust with your theme div
                                $divahrefwrap = '<div class="g1-cta"><p class="g1-cta-button-wrap"> <a href="'.$img['source_link'].'" class="g1-button g1-button-subtle g1-button-l g1-button-wide g1-cta-button" target="_blank" rel="nofollow"> Visit Direct Link </a></p></div>';
                                    $my_post = array(
                                                'ID' => $id,
                                                'post_content' => $customFieldSet[1].$divahrefwrap
                                    );

                                    wp_update_post( $my_post );
                               
                                   
                        } else {
                            add_post_meta ( $id, $customFieldSet [0], $customFieldSet [1] );
                        }
                    } // foreach field
                } // if array
            } // if feed

test with Bimber v8.3.5 - Viral Magazine WordPress Theme downloaded from babiato
*the result after fetch is like this
4.png


*from og:description with source link
regex|<meta property="og:description" content="(.*?)"|to_post_content_with_source_link
2.png

*from og:description without source link
regex|<meta property="og:description" content="(.*?)"|to_post_content
 
Last edited:
  • Love
Reactions: Iron-Man
well just add new condition to php code
PHP:
//replace the code that I provide above with the code below

// Feeds part to field extraction set
            if ($camp_type == 'Feeds') {
          
                $customFieldsArr = $img ['custom_fields'];
          
                if (is_array ( $customFieldsArr ) && count ( $customFieldsArr ) != 0) {
              
                    foreach ( $customFieldsArr as $customFieldSet ) {
                  
                        if ($customFieldSet [0] == 'excerpt') {
                            $my_post = array (
                                    'ID' => $id,
                                    'post_excerpt' => $customFieldSet [1]
                            );
                      
                            wp_update_post ( $my_post );
                        } elseif ($customFieldSet [0] == 'tags') {
                      
                            if (in_array ( 'OPT_TAXONOMY_TAG', $camp_opt )) {
                                wp_set_post_terms ( $id, $customFieldSet [1], trim ( $camp_general ['cg_tag_tax'] ), true );
                            } else {
                                wp_set_post_tags ( $id, $customFieldSet [1], true );
                            }
                        } elseif (stristr ( $customFieldSet [0], 'taxonomy_' )) {
                      
                            wp_set_post_terms ( $id, $customFieldSet [1], str_replace ( 'taxonomy_', '', $customFieldSet [0] ), true );
                        }elseif( $customFieldSet[0] == 'to_post_content'){
                              
                                    $my_post = array(
                                                'ID' => $id,
                                                'post_content' => $customFieldSet[1]
                                    );

                                    wp_update_post( $my_post );
                              
                        }elseif( $customFieldSet[0] == 'to_post_content_with_source_link'){
                                //this html format for bimbel theme, or adjust with your theme div
                                $divahrefwrap = '<div class="g1-cta"><p class="g1-cta-button-wrap"> <a href="'.$img['source_link'].'" class="g1-button g1-button-subtle g1-button-l g1-button-wide g1-cta-button" target="_blank" rel="nofollow"> Visit Direct Link </a></p></div>';
                                    $my_post = array(
                                                'ID' => $id,
                                                'post_content' => $customFieldSet[1].$divahrefwrap
                                    );

                                    wp_update_post( $my_post );
                              
                                  
                        } else {
                            add_post_meta ( $id, $customFieldSet [0], $customFieldSet [1] );
                        }
                    } // foreach field
                } // if array
            } // if feed

test with Bimber v8.3.5 - Viral Magazine WordPress Theme downloaded from babiato
*the result after fetch is like this
4.png


*from og:description with source link
regex|<meta property="og:description" content="(.*?)"|to_post_content_with_source_link
2.png

*from og:description without source link
regex|<meta property="og:description" content="(.*?)"|to_post_content

Thank you very much. It works like charm. Now it is working fine as per my expectations. This is also working in the latest version of wp automatic. This is also working fine when I use this feature (regex|<meta name="description" content="(.*?)"|_yoast_wpseo_metadesc) to fetch and store meta data in yoast settings.

I have just few queries.

1) I don't know much about codes. I observer that by using this code, the click button seems odd. In bimber, by simply choosing the link format, it give a nice button itself & also in its setting it give control to open in new tab or not.

So I change this:
$divahrefwrap = '<div class="g1-cta"><p class="g1-cta-button-wrap"> <a href="'.$img['source_link'].'" class="g1-button g1-button-subtle g1-button-l g1-button-wide g1-cta-button" target="_blank" rel="nofollow"> Visit Direct Link </a></p></div>';

To this:
$divahrefwrap = '<a href="'.$img['source_link'].'"> Visit Direct Link </a>';

Here it simple give a link inside my post. I guess i am doing everything all right.


2) You codes helped me in my needs. But it seems the post text template is not working after this code. May be using this feature ( "Specific extraction to a custom field, excerpt, tags or custom taxonomy ") replace the post text template feature.

Its fine. Right now I am planning to use feed/multi page scrapper campaigns only in this format. May be to use the post text template I have to disable this feature ( "Specific extraction to a custom field, excerpt, tags or custom taxonomy ").


3) After posting, in its source, I have found 2 such info (meta property="og:description"). In a normal post, I think there is only one such info regarding meta property="og:description". But after extracting post in this way, there is 2 such info in a post.
2 meta.JPG

Is this fine that my post have such 2 info. Or it will have some seo impact.
 
2) You codes helped me in my needs. But it seems the post text template is not working after this code. May be using this feature ( "Specific extraction to a custom field, excerpt, tags or custom taxonomy ") replace the post text template feature.
if you want to use post text template feature, don't use "Specific extraction to a custom field, excerpt, tags or custom taxonomy " with command to_post_content or to_post_content_with_source_link then the post text template feature should work normally
 
  • Like
Reactions: Iron-Man
if you want to use post text template feature, don't use "Specific extraction to a custom field, excerpt, tags or custom taxonomy " with command to_post_content or to_post_content_with_source_link then the post text template feature should work normally
Hello bro, thanks for clarifying about query number #2.

What about query number #1 and #3. Are they fine too.
 
Hello bro, thanks for clarifying about query number #2.

What about query number #1 and #3. Are they fine too.
#1. you right you can change the $divahrefwrap to fit what you want

#3. in my opinion
i think this is a problem with the plugin or theme so the meta og: description appears twice in the head section.
Because Open Graph meta tags are snippets of code that control how URLs are displayed when shared on social media such as FB, whatsapp, instagram, twitter, etc.
even though the meta og appears twice in the head section
i think it will not really impact to Google's SEO
 
  • Like
Reactions: Iron-Man
Thanks for replay. I have found that the duplicate meta description is related to my theme. I will sort it out later.

Anyway, thanks for helping me. My problem is solved now.
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock