abrudtkuhl / WordPressSharp

A C# client to to interact with the WordPress XML-RPC API
abrudtkuhl.github.io/WordPressSharp/
GNU General Public License v3.0
103 stars 49 forks source link

Custom Fields are not saved #66

Closed miguelangelss4 closed 7 years ago

miguelangelss4 commented 7 years ago

I'm having trouble with custom fields.

I have a new post with several values in customfields list, and I call NewPost function. The post is stored at database, but custom fields are not stored at postmeta table...

image

dmarklein commented 7 years ago

I'm seeing the same thing. I'm trying to set the template for a page by setting the _wp_page_template meta field, but it's not making it into the database.

miguelangelss4 commented 7 years ago

I want to add a CustomField to de customfields list, only to test that the problem is not a value with wrong serialization. I tried this: NuevoPopup.CustomFields.ToList().Add(New WordPressSharp.Models.CustomField With {.Key = "msolla_prueba", .Value = "test"})

But it don't add anything. Can I add a customfield? how?

miguelangelss4 commented 7 years ago

Is there any updates here?

abrudtkuhl commented 7 years ago

I will take a look this week. Planning some time to address a couple issues

miguelangelss4 commented 7 years ago

Thanks you so much Andy, I wait for news.

DUAB-Johan commented 7 years ago

@dmarklein Wordpress does not allow changes to database-columns preceding with _ by default. You have to add them to functions.php to allow the update:

function register_meta() { register_meta( 'post', '_description', '_meta_sanitize_cb', '_meta_yes_you_can'); } add_action( 'init', 'register_meta' );

miguelangelss4 commented 7 years ago

@DUAB-Johan hi I'm seeing in documentation that this function (register_meta) only allow 3 parameters, and you had posted 4.

What are the values that you pass to register_meta?

Anyway, my meta_key is popupcondition, it does not preceded by ... your answer is valid to me? Thanks!

miguelangelss4 commented 7 years ago

@abrudtkuhl, can you saw this issue? thanks!

abrudtkuhl commented 7 years ago

I believe this was fixed with #64