Advanced Custom Fields not saving at all now - wordpress

I downloaded and installed Advanced Custom Fields 4.1.6 the other day and I used it a few times for some time and it worked perfectly, but for some reason now none of my custom fields seem to be saving and I'm not getting any errors or anything. I don't think that I have done anything at all that could have possibly broken this.
Has this happened to anyone else? And what could possibly be the issue?

I think you might have to take a look at export function the plugin provides. Select a field group you created and hit export. It'll generate some code which is pretty good commented with tips and advice. There might be some information there for good use for 'ya.
Example by the plugin developer:
Include in theme
The Advanced Custom Fields plugin can be included within a theme. To do so, move the ACF plugin inside your theme and add the following code to your functions.php file:
include_once('advanced-custom-fields/acf.php');
To remove all visual interfaces from the ACF plugin, you can use a constant to enable lite mode. Add the following code to your functions.php file before the include_once code:
define( 'ACF_LITE', true );
Hope it helps.
/Paul

Since my rep isn't high enough to reply to #Kortschot's response, I'll comment here.
I got this error while testing a new theme. It appears the theme has ACF bundled into the theme, which triggers the "Cannot redeclare acf_filter_post_id()" error. For obvious reasons (you can't run two instances of the plugin in the same install). #Kortschot's reference to including ACF in a theme helped solve my problem.
Now I have to figure out how to access ACF if I want to customize fields on pages/posts...

I'm gonna go ahead and reply to this old question in hopes that it helps someone out. I have been having this problem where my fields would not update on my custom posts. I usually have multiple tabs open to make navigation easier in the backend of WP. It turns out that when I closed all other tabs except the current one I'm editing, the fields update every time!

I have same problem with Advanced custom fields plugin , i resolve my issue by adding one line code in advanced-custom-fields/core/controllers/post.php
add_action('pre_post_update', array($this, 'save_post'));
after
add_action('save_post',array($this, 'save_post'), 10, 1);
line number 33, 34.

I had the same problem and fixed it by creating unique field names.

Related

How to create Child Plugin for wordpress

Actually I have changed some code in WordPress Store Locator. I want it to remain when plugin will update. So I want to create a child plugin for that. Any ideas on how I could manage it?
This varies plugin to plugin, and it sometimes isn't even possible, other times plugins have documentation to extend them easily (such as WooCommerce and Gravity Forms). Some of them create Action Hooks with do_action() that let you extend the functionality easily. A common example is updating a post after a Gravity Form is submitted with their gform_after_submission hook.
Effectively, it depends on what you want to do, and how the plugin implements the functionality you want to change. If they add text with a Closure or Anonymous Function, it will be harder to modify said text, and you may have to look at something strange like doing a run-time find and replace using Output Buffering, typically on the template_redirect hook.
If you want to remove something a plugin does, you can often unhook it with remove_action. This can be a bit tricky depending on how the plugin is instantiated, sometimes its as simple as:
remove_action( 'some_hook', 'function_to_remove' );
Other times it's more complicated like:
global $plugin_class_var;
remove_action( 'some_hook', array($plugin_class_var, 'function_to_remove') );
Those are the basics of extending (or even 'shrinking'?) a plugin's functionality, and it's not always doable appropriately. Unfortunately the narrow answer to your question is outside of the scope of what we can provide from StackOverflow.
From here, you'll need to figure out exactly what you want to do with the plugin, and dig through the plugin's files to see if there's an appropriate hook or function you can use. If you're still stuck, you'll need to post a new question (don't update this one) with your exact desired result and anything you've tried, and the relevant code that goes along with it. "I want to change a plugin without editing core files" isn't nearly specific enough. "I want to replace an icon with a custom icon in this plugin, here's what I've tried" is specific enough to possibly answer.
Good luck!
I just went through myself and I had so many changes that I couldn't just override the actions.
I created this tool that allows you to create a child plugin like a child theme. You can make updates to the plugin and still update it without losing your changes.
I'm posting this here because it relates and hopefully becomes useful to the next person who runs into this issue.
https://github.com/ThomasDepole/wordpress-child-plugin-tool
As per WordPress standard, it's called plugin's addon.
if the plugin has provided any action to update that functionality then you can use it with your addon (child plugin).
Here I am sending a link for reference.
https://developer.wordpress.org/reference/functions/add_action/

CMB Metabox and custom fields

Sorry, I hope this is simple, but does Web Dev Studios Custom Metabox feature (https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress) need to save the data to the custom fields?
Basically I have it installed and it works but none of the data entered is appearing in the custom fields box like on another site I have, is this going to cause an issue?
Thanks,
sorry I dont have experience with that one. Use Advanced Custom Fields plugin. It'll be lot easier for you. you can even include it to your theme.
Nope, CMB Automatically save the data and retrieve. you may made any mistake, please switch on wp-debug (wp-config.php) and see if you can see any error.
Advance custom field is an alternate solution which has Graphical User Interface. you can also use it.

Updating Wordpress Permalinks

I have created a plugin that uses custom posts. To get these to display the permalinks need re-saving, no need to change anything, they just need re-saving.
There must be a way to do this using a hook but I can't work out how to do this. The function flush_rules looks like it might do the job but it doesn't seem to work.
Sample code here: http://codex.wordpress.org/Rewrite_API/flush_rules
Ok solved it.
You just have to add the flush to the custom post registration:
register_post_type('custompostname',$args);
flush_rewrite_rules(false);
So simple really, just took me a while to find it.

Add custom fields while add/edit wordpress category

I am using WP-3.5.1 and want to know how can we add more custom fields (image, radio, check-box, drop-down) while adding/editing category?
I found http://en.bainternet.info/2011/wordpress-category-extra-fields but first here author did not mention
Where to add his code?
For which version of wp this code be use?
What affect if we upgrade to latest version?
What must be pass extra_category_fields( $tag ) in?
so I start from wp-admin/edit-tags.php and paste his code right after where Slug field is defined but stuck on $tag what should be pass here?
Is there any plugin to add custom fields in category like More Field which is for posts?
First thing, there is a big red warning in that page:
So, clearly, you'd better use the new version.
Second, you should never modify core files (/wp-admin/edit-tags.php). The following Q&A explains where you should put code enhancements in your WordPress site:
Where to put my code: plugin or functions.php?
Restore your core files to its original state using the following instructions.
Try to always use the latest version of WordPress, Themes and Plugins, as having old code in your site may have serious security/performance implications.
The new version of Taxonomy Extra Fields has much more examples in its documentation, so probably your configuration doubts would change.
All that said, the plugin Advanced Custom Fields is able to put extra fields in Taxonomies (categories, tags, custom taxonomies) very easily, no coding required.
Okay:
To add image filed while add/edit category use this plugin it is awesome plugin.
http://wordpress.org/extend/plugins/categories-images/

How can I attach a file using Wordpress custom fields / meta boxes?

I am using Wordpress's add_meta_box() function to add customized meta fields to the Add New Post page, like this. I want one of these fields to allow the user to upload a file, so that a single image, pdf, audio file, or video can be associated with the post.
The closest example I've seen is this one (link removed*). Unfortunately it does not suit my needs, as I want my file to be processed by Wordpress's Media Uploader - so it should appear in the Media Library afterwards, and thumbnails should be generated according to the Media settings.
I think ideally there would be a way to tap into Wordpress's existing Add Media dialog, and simply output the URL of the uploaded file into a text box, but I don't see how to do that. This question is similar, but the answers are a little clunky - I would like to keep this super simple for my end users.
How can I accomplish this? Please do not recommend plugins such as Flutter or Magic Fields - I have tried these and they do not suit my purposes (I want the images to be processed by Wordpress's Media Uploader). I am using Wordpress 3.0-alpha.
(*=link removed due to report of malware; it is in the archive, but at own risk)
I eventually figured this out for myself and got it working just as I wanted, and thought I would post an update for anyone who finds this question and is curious.
I did not use any plugins, but wrote a custom function to handle file uploads for my theme. I used built-in Wordpress functions such as save_custom_postdata(), wp_handle_upload(), wp_insert_attachment(), wp_generate_attachment_metadata() and wp_update_attachment_metadata().
I also had to use add_action('admin_head'...) to add some JavaScript which adds "multipart/form-data" to the form tag on the Edit Post page, to allow file uploads.
I would post my code, but it is very long and specific to my project.
You needn't use JavaScript to edit the form. This is possible to do using the post_edit_form_tag function like so:
add_action( 'post_edit_form_tag' , 'post_edit_form_tag' );
function post_edit_form_tag( ) {
echo ' enctype="multipart/form-data"';
}
More details (including an example) are available at http://codex.wordpress.org/Plugin_API/Filter_Reference/post_edit_form_tag.
Take a look at Image Widget - a well made widget that does what you want, but as a widget. Maybe you can convert it to work on your Add new post page.
Another plugin you can try is Pods CMS. Might be overkill but when you do fileuploads with this, they are automaticly added to the media library.
This WordPress Meta Box PHP Helper class might help you when working with WordPress Meta Boxes.
I think this is what you're looking for: http://wordpress.org/extend/plugins/nkmimagefield/
Apparently it doesn't support custom post types but a little hacking should do. It already does the hard work of interfacing with the media editor.

Resources