Update aioseop_description with php | Troubleshooting All in One SEO Pack Pro | Support | Semper Plugins

Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Update aioseop_description with php
October 25, 2018
5:51 am
Avatar
bas tegelaar
Member
AIOSEOP
Forum Posts: 3
Member Since:
April 24, 2018
sp_UserOfflineSmall Offline

Hello,

I have an issue, I would like to update the seo description by running a php line. (the reason i want this is because we use custom fields, and can automate this process then) but
If i wish to update a post meta, the following line works fine, but when i try to update it for the aioseo meta fields, it does not work.

This works:
update_post_meta( $post_id, ‘customfieldexample’, “textiwishtoinsert”);

This does not:
But neither of the following options work (no error, but just doesnt seem to update)
update_post_meta( $post_id, ‘aioseop_description’, “textiwishtoinsert”);
update_post_meta( $post_id, ‘_aioseop_description’, “textiwishtoinsert”);

Is there a other way for me to update the aioseo description field with php?

October 25, 2018
10:07 am
Avatar
Steve Mortiboy
Admin
Forum Posts: 1898
Member Since:
January 5, 2012
sp_UserOfflineSmall Offline

** You currently do not have permission to see this post. To obtain access to these Premium Support Forums, please purchase a plugin and support subscription from Semper Plugins **

October 25, 2018
11:55 am
Avatar
bas tegelaar
Member
AIOSEOP
Forum Posts: 3
Member Since:
April 24, 2018
sp_UserOfflineSmall Offline

Steve Mortiboy said
Hi Bas,

If you’re trying to output the contents of a custom field into the meta description created by All in One SEO Pack Pro then you don’t need to use  update_post_meta(), you can use our filter like this where the post type is “post” and the custom field is “custom description”:

 

function custom_aioseop_description( $description ) {
if( is_singular( 'post' ) ) {
$description = $description . ' - %cf_custom_description%';
}
return $description;
}
add_filter( 'aioseop_description', 'custom_aioseop_description', 10, 1 );


  

Hello,

First of all, thank you for the reply

This is almost what i want, i am looking for actually getting the content added in the backend on wordpress in the description field (and making it run on save_post) so it can also be changed if needed. Would this be possible?

October 25, 2018
12:55 pm
Avatar
Steve Mortiboy
Admin
Forum Posts: 1898
Member Since:
January 5, 2012
sp_UserOfflineSmall Offline

** You currently do not have permission to see this post. To obtain access to these Premium Support Forums, please purchase a plugin and support subscription from Semper Plugins **

October 25, 2018
12:59 pm
Avatar
bas tegelaar
Member
AIOSEOP
Forum Posts: 3
Member Since:
April 24, 2018
sp_UserOfflineSmall Offline

Steve Mortiboy said
Hi Bas,

Unfortunately this is not possible.  You could edit the custom field but there’s no way to output that in the Description field in All in One SEO Pack Pro.  

Ok, that is a shame,  thank you for the reply.

 

I believe i have a workaround now.

I now check if the description is empty, and if it is, i apply the filter.  This way i can still override the description field (not how i originally wanted, but this seems to work)

 

function custom_aioseop_description( $description, $post_id) {
if($description == Null){
$seotest = get_field(‘seodescrip’,$post_id);
$description = $seotest;
}

return $description;
}

add_filter( ‘aioseop_description’, ‘custom_aioseop_description’, 10, 1 );

Forum Timezone: America/New_York

Most Users Ever Online: 964

Currently Online:
44 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 35

Members: 20178

Moderators: 0

Admins: 8

Forum Stats:

Groups: 4

Forums: 28

Topics: 1917

Posts: 8176

Newest Members:

support@omsaisecurityservices.com

Administrators: Michael TorbertPeter BayliesSupport TeamSteve MortiboyMatthew RobinsonSteve KlasenArnaud BroesAshish Ravi

[i]
[i]
Skip to toolbar