Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterI think you write the
update_post_metaincorrectly, it should be:update_post_meta( get_the_ID(), 'link_counter', $count );September 22, 2017 at 4:02 PM in reply to: How to set meta_query of Group cloneable fields for search #7023Anh Tran
KeymasterThanks a lot for your solution. It's extremely helpful for other people.
Anh Tran
KeymasterHi,
Do you mean create a settings page for editors? If so, please set the
'capability' => 'edit_pages'for the settings page. The capabilityedit_pagesis available for only editors and admins.If you need a plugin to manage/create custom capabilities, please try the Members.
Anh Tran
KeymasterHi again,
I found the problem for your situation. Your check doesn't run when post is updated, because there's no
$GET['post']. In that case, you need to get post ID via$_POST. Here is the code:function prefix_parent_page_id_check() { $parents = get_post_ancestors( prefix_get_post_id() ); return $parents && 901 == array_pop( $parents ); } function prefix_get_post_id() { if ( isset( $_GET['post'] ) ) { return intval( $_GET['post'] ); } if ( isset( $_POST['post_ID'] ) ) { return intval( $_POST['post_ID'] ); } return false; }Anh Tran
KeymasterWhy don't you use
parentrule? It's supported by default ๐Anh Tran
KeymasterStrange, I've just tested with your code and it works. Do you have any "check" code that runs along with (maybe before) the code for Meta Box?
Anh Tran
KeymasterHi,
It's recommended to use a hook like 'plugins_loaded', 'init' or better - activation hook to create a new table. In case of a theme, you can hook into 'init', like this:
add_action( 'init', 'prefix_create_table' ); function prefix_create_table() { if ( ! class_exists( 'MB_Custom_Table_API' ) ) { return; } MB_Custom_Table_API::create( 'my_custom_table', array( 'address' => 'TEXT NOT NULL', 'phone' => 'TEXT NOT NULL', 'email' => 'TEXT NOT NULL', ), array( 'email' ) ); }For more info, please see the sub-section E. in the section Notes of the documentation.
Anh Tran
KeymasterHi,
The 'std' value works only the first time, e.g. when you haven't save any settings. In your case, if you delete the field value, then the plugin should "remember" your choice - whatever you did - which is the empty value in this case. It would be much confused if it shows the 'std' value, because two things: 1) you wonder where it comes from and 2) you can't actually save an empty value.
Anh Tran
KeymasterCan I see your function for test top parent page ID? Can you post your code?
Anh Tran
KeymasterHi,
I've just tried your code with Conditional Logic plugin enabled. Everything works as expected.
Maybe the problem is in the custom JavaScript code, which might breaks the JS code in the plugin(s). Can you please check when exactly the post doesn't save image_select value?
September 11, 2017 at 2:13 PM in reply to: How to set meta_query of Group cloneable fields for search #6949Anh Tran
KeymasterHi,
When you use cloneable fields (whether it's a group or not), the data is saved as a serialized array in the database. That makes the default meta_query doesn't work when search for posts by meta value.
In this case, you need to use a plugin like SearchWP.
Anh Tran
KeymasterHi,
You can run a SQL query like this:
DELETE FROM wp_postmeta WHERE meta_key IN ('field1', 'field2');Anh Tran
KeymasterNo problem, refund is sent.
If you change your mind, we'll be happy to help.
Anh Tran
KeymasterI'm afraid this is a hard problem. As the
file_uploaduses Media Library to upload files, all it does is calling the popup, passing the required parameters for the uploader (mime types, file size, etc.) and parsing the returned data. I've just checked the code and couldn't find anything related to the current field, because the uploader doesn't need that. But can you tryprint_reverything global ($_POST,$_GET, etc.) when filtering? Probably I'm missing something.August 26, 2017 at 9:17 AM in reply to: โ Group not saving new items, overwriting old ones. Big mess. #6771Anh Tran
KeymasterHi,
I've just tested your code and here is the recorded screen:
I guess the problem is caused by cached JavaScript. In every new version of Group extension, most of the changes are in JavaScript file. So please try clearing browser cache (or Ctrl-F5) and check it again.
Thanks,
Anh -
AuthorPosts