Custom Post Type Capabilities

Ok – lets try this again 🙂 I added the map_meta_cap parameter which is needed to have delete_others_posts work. Now I was able to get authors to edit and view all posts but only delete their own. $labels = array( ‘name’ => __( ‘Book’, ‘textdomain’ ), ‘singular_name’ => __( ‘Book’, ‘textdomain’ ), ‘menu_name’ => __( … Read more

Prevent stripping MathML tags on post save

The MathML tags are removed by the editor. TinyMCE (the editor) removes tags that are not in its “valid_elements” list. The MathML tags and tag-attributes must be added via the “extended_valid_elements” list (seen below). Place the below code in your functions.php file. function mce4_options($opt){ $opt[‘extended_valid_elements’] = ‘math[class|id|xmlns|altimg|alttext|display|overflow],semantics[encoding|definitionURL],annotation[encoding|definitionURL|cd|name|src],annotation-xml[cd|name|encoding|definitionURL|src],merror,mtext,mspace,mover[accent|align],munder,munderover,mstack,mrow[dir],msrow,mfenced[open|close|separators],menclose[notation],mphantom,msup,msub,msubsup,mmultiscripts,mi,mn,mo[fence],ms,mtable,mtr,mtd,mlabeledtr,mfrac[linethickness|bevelled|numalign|denomalign],mfraction,msline,msqrt,mroot,mscarries,mscarry’; return $opt; } add_filter(‘tiny_mce_before_init’,’mce4_options’,25); The above code is … Read more

Why would media_sideload_image() not work locally?

Ah, this is silly, but it turns out there was a very obvious reason why media_sideload_image() wasn’t working. My wp-content folder had the wrong the permissions from when I transferred it to my local environment and I wasn’t able to upload anything. Changed the permissions and it’s working fine.

Creating table layout in WYSIWYG editor

Why you are not using table? Spaces are ridiculus. On WYSIWYG editor select table with 2 columns and 3 rows, align items in left column to left, and in right to center and everything should work fine. EDIT. Ok, I see where is the problem. TinyMCE (WYSIWYG editor) has table option, but by default it … Read more

How to edit title on Edit post pages?

Add this code instead on your functions.php, this will change the post and product title to the post or product that is being edit: add_filter(‘admin_title’, ‘my_admin_title’, 10, 2); function my_admin_title($admin_title, $title) { global $post, $action; if ( isset($post->post_title) and $action == ‘edit’ ){ return ‘Edit < ‘.$post->post_title.’ – ‘.get_bloginfo(‘name’); } else { return $title .’ … Read more

editor-style.css Functionality

The correct way to enqueue an editor stylesheet is as follows: add_action( ‘after_setup_theme’, ‘generate_child_setup’ ); function generate_child_setup() { add_editor_style( ‘path/to/editor-style.css’ ); } I pulled that snippet from here: https://generatepress.com/forums/topic/how-to-call-editor-style-css-from-child-theme/#post-149083 I guess the intuitive approach for most would be to enqueue it in the admin but that wouldn’t apply it correctly. I believe add_editor_style() ensures it’s … Read more

Are there individual memory allocations for different user roles in WordPress?

Because of this line in wp-admin/admin.php: if ( current_user_can( ‘manage_options’ ) ) { wp_raise_memory_limit( ‘admin’ ); } In other words, WordPress raises the memory limit to WP_MAX_MEMORY_LIMIT within the admin, but only for users with the manage_options capability i.e. administrators. Your best bet is to raise the default memory limit in your wp-config.php: define( ‘WP_MEMORY_LIMIT’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)