How to fill Yoast WordPress SEO plugin custom fields in MarsEdit [TUTORIAL]
  • I posted that on WordPress.org Forum as well. I didn’t come with the solution by myself but instead I owe it to a previous thread published in this forum: see http://www.red-sweater.com/forums/discussion/1921/custom-fields-not-saved-by-wordpress/p1

    * * *

    The instructions displayed below were tested on WordPress 3.5.1 with MarsEdit 3.5.8 It’s quite easy and involves two steps: 1) Edit the meta.php file in your WordPress installation; 2) Edit the MarsEdit setting for your WordPress blog in order to configure Yoast’s plugin custom fields. All in all it should take you five to fifteen minutes. Faster if you’re familiar with editing PHP file.

    1) First using an FTP client go to the root folder of your WordPress installation and locate the folder wp-includes;

    2) In this folder, locate the file meta.php Just to be safe download a copy of it: if something goes wrong during the editing, you will always be able to revert back to the original file.

    3) Using an editor (such as TextWrangler or TextMate) open the meta.php file and perform a search for “is_protected_meta” You should be able to find the following snippet of code around line no. 854:

    /**
    * Determine whether a meta key is protected
    *
    * @since 3.1.3
    *
    * @param string $meta_key Meta key
    * @return bool True if the key is protected, false otherwise.
    */
    function is_protected_meta( $meta_key, $meta_type = null ) {
    $protected = ( '_' == $meta_key[0] );

    return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type );
    }

    You don’t need to change everything only the line that start with `$protected` This WHOLE line should be changed to the following:

    $protected = (( '_' == $meta_key[0] ) && ( strpos($meta_key, "_yoast") !== 0));

    That’s it. You’re done with editing your meta.php file.

    4) Now head over to MarsEdit. In the Main Window (Window>Main Window), locate your WordPress blog in the column on the left (it may be the only one or you may have multiple blog set there running on various platforms).

    5) Right-click on its name and choose “Edit settings” from the drop-down menu that appears.

    6) In the “Edit settings” window, choose the tab completely on the right: “Custom Fields”

    7) Depending on how you use Yoast’s plugin (which official name is “WordPress SEO”) you need to create three or four of those custom fields. I don’t use meta keywords, so I only need three. For each of those field whose name will appear in the left column, you’ll need to assign a “Server Custom Field Name” in the right column. I did it like this (the dots are only there to replicate the table: they divide between the left and right column you’ll find under the “Custom Fields” tab:

    SEO Title.........._yoast_wpseo_title
    SEO Desc........._yoast_wpseo_metadesc
    SEO FW............_yoast_wpseo_focuskw

    Click “OK” (lower right) and you’re done. It worked for me. What it does is fill Yoast’s plugin fields on WordPress with the proper value you will have created in MarsEdit. You can test it simple by creating a test post in MarsEdit: fill all the fields with the value you want, set the post for “draft” instead of “publish” and send it to your blog. Then, head over to your WordPress dashboard to see if all the fields are there.

    Hope it helps some of you.

    P.
  • I would also be curious to hear about security: is this modification susceptible to cause a security issue or will it only allow an approved (i.e. with proper credentials) xmlrpc protocol to modify values in WordPress?
  • Daniel JalkutDaniel Jalkut
    Accepted Answer
    If other folks come across this, if you are specifically looking for the workaround in Yoast's WordPress SEO plugin, I recommend checking out his changes to the plugin:

    http://wordpress.org/support/topic/consider-whitelisting-editing-of-custom-fields?replies=4#post-3808783

    Sounds like he will be integrating it for an official update to the plugin at some point.
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!