Display all meta for a post?
To get all rows, don’t specify the key. Try this: $meta_values = get_post_meta( get_the_ID() ); var_dump( $meta_values ); // so you can see the structure
To get all rows, don’t specify the key. Try this: $meta_values = get_post_meta( get_the_ID() ); var_dump( $meta_values ); // so you can see the structure
Solved it! Hope somebody else can use it or it answers their problem. If there is a better way please share and tell why. $editor_id = ‘custom_editor_box’; $uploaded_csv = get_post_meta( $post->ID, ‘custom_editor_box’, true); wp_editor( $uploaded_csv, $editor_id ); To save the data: function save_wp_editor_fields(){ global $post; update_post_meta($post->ID, ‘custom_editor_box’, $_POST[‘custom_editor_box’]); } add_action( ‘save_post’, ‘save_wp_editor_fields’ ); And that’s … Read more
The structure is stored in the option permalink_structure. Pretty permalinks are disabled if the option is empty. $structure = get_option( ‘permalink_structure’ );
The get_search_form() echos so it will always show up before returns. Use: get_search_form( false )
The solution below will parse the comma separated values passed to the shortcode’s type parameter. We’ll also strip out any whitespace surrounding the values which is a usability improvement (see example 2 after the code below). add_shortcode( ‘related’, ‘wpse_related’ ); function wpse_related( $atts, $content=”” ) { // User provided values are stored in $atts. // … Read more
You have to use a string as key: $menu[‘26.0648’][0] = ‘Event Calendar’; If you write the key as a number, it will truncate the decimal to an integer, so 26.0648 will be truncated to 26.
You cannot save raw PHP inside post content, it gets cleaned out on save. This is an obvious security precaution. However, there are plugins that will enable you to do this, for example: http://wordpress.org/extend/plugins/allow-php-in-posts-and-pages/ This is not recommended though, better solution would be to create a generic shortcode for your from.
You could run a check on the save_post hook, but WooCommerce already has a hook for processing meta where the post type and security checks have already been done. So using their hook, you just check for a null string on the regular price and set it to 0. function wpa104760_default_price( $post_id, $post ) { … Read more
WordPress doesn’t use PHP sessions, so WordPress itself can not be related with your sessions working or not regarding if you are logged in or not (I think). Try to call session_start() on init action instead of doing it in a template file and be sure it is called before your custom library is loaded. … Read more
Query vars are for use in the main $wp_query query object, your custom admin page has no main query, so no vars are parsed into a query object that can be accessed via get_query_var. I don’t think there’s anything WordPress-specific that can be used in this case, I would just access the value via $_GET.