20¸öʵÓõÄWordPress SQL²éѯ
¡¡¡¡WordPress½«ÆäËùÓÐÐÅϢƬ¶Î(°üÀ¨ÎÄÕ¡¢Ò³Ãæ¡¢ÆÀÂÛ¡¢²©¿ÍÁ´½Ó¡¢²å¼þÉèÖõÈ)´æ´¢ÔÚMySQLÊý¾Ý¿âÖС£ ËäÈ»WordPressÓû§¿ÉÒÔͨ¹ýÍøÕ¾ºǫ́±à¼¿ØÖÆÒÔÉÏÐÅϢƬ¶Î¡£ ÔÚÒ»¶¨³Ì¶ÈÉÏ¡£
¡¡¡¡²»¹ý¼ÙÉèÄãµÄWordPressÍøÕ¾ÉÏÓгɰÙÉÏǧƪÎÄÕ£¬¶øÄãÐèÒª½øÐÐÈ«Õ¾·¶Î§µÄ¸Ä¶¯£¬ Õâʱ´Óºǫ́ÖðÌõ±à¼¾ÍÓеã·Ñʱ·ÑÁ¦ÁË£¬²¢ÇÒ·¸´íµÄ¼¸ÂÊÒ²»áÌá¸ß¡£ ×îºÃµÄ·½·¨ÊǽøÈëWordPressµÄMySQLÊý¾Ý¿âÖ´ÐбØÒªµÄ²éѯ(¸Ä¶¯)¡£ ͨ¹ýMySQL¿ÉÒÔѸËÙµØÍê³ÉÒÔÉÏÈÎÎñ£¬ÎªÄã½ÚÊ¡¸ü¶àʱ¼ä¡£
¡¡¡¡ÏÂÃæÒª½éÉܵľÍÊÇһЩʡʱʡÁ¦µÄWordPress SQL²éѯ·½·¨¡£
¡¡¡¡ÊÂÏȱ¸·Ý
¡¡¡¡WordPressÊý¾Ý¿âÀï´æ´¢ÁËÄ㾫ÐÄ·¢±íµÄÿһƪÎÄÕ£¬À´×ÔÄãµÄ¶ÁÕßµÄËùÓÐÆÀÂÛ£¬ÒÔ¼°Äã¶Ô×Ô¼ºÍøÕ¾½øÐеÄËùÓиöÐÔ»¯ÉèÖᣠÒò´Ë£¬ÎÞÂÛÄã¶Ô×Ô¼ºÓжà×ÔÐÅ£¬¶¼Çë¼Çסһ¶¨ÒªÊÂÏȱ¸·ÝWordPressÊý¾Ý¿â¡£ Äã¿ÉÒÔͨ¹ý±¸·Ý²å¼þ½øÐб¸·Ý¡£
¡¡¡¡ÎªËùÓÐÎÄÕºÍÒ³ÃæÌí¼Ó×Ô¶¨Òå×Ö¶Î
¡¡¡¡Õâ¶Î´úÂë¿ÉÒÔΪWordPressÊý¾Ý¿âÄÚËùÓÐÎÄÕºÍÒ³ÃæÌí¼ÓÒ»¸ö×Ô¶¨Òå×ֶΡ£ ÄãÐèÒª×öµÄ¾ÍÊÇ°Ñ´úÂëÖеđUniversalCutomField‘Ìæ»»³ÉÄãÐèÒªµÄÎÄ×Ö£¬È»ºó°Ñ‘MyValue‘¸Ä³ÉÐèÒªµÄÖµ¡£
ÒÔÏÂΪÒýÓõÄÄÚÈÝ£ºINSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT ID AS post_id, 'UniversalCustomField' AS meta_key 'MyValue AS meta_value FROM wp_posts WHERE ID NOT IN (SELECT post_id FROM wp_postmeta WHERE meta_key = 'UniversalCustomField') `` AND post_type = 'post'; |
¡¡¡¡Èç¹ûÖ»ÐèҪΪҳÃæÌí¼Ó×Ô¶¨Òå×ֶΣ¬¿ÉÒÔʹÓÃÏÂÃæÕâ¶Î´úÂ룺
ÒÔÏÂΪÒýÓõÄÄÚÈÝ£ºINSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT ID AS post_id, 'UniversalCustomField' AS meta_key 'MyValue AS meta_value FROM wp_posts WHERE ID NOT IN (SELECT post_id FROM wp_postmeta WHERE meta_key = 'UniversalCustomField') AND `post_type` = 'page'; |
¡¡¡¡É¾³ýÎÄÕÂmetaÊý¾Ý
¡¡¡¡µ±Äã°²×°»òɾ³ý²å¼þʱ£¬ÏµÍ³Í¨¹ýÎÄÕÂmeta±êÇ©´æ´¢Êý¾Ý¡£ ²å¼þ±»É¾³ýºó£¬Êý¾ÝÒÀÈ»»á´æÁôÔÚpost_meta±íÖУ¬µ±È»ÕâʱÄãÒѾ²»ÔÙÐèÒªÕâЩÊý¾Ý£¬ÍêÈ«¿ÉÒÔɾ³ýÖ®¡£ ¼ÇסÔÚÔËÐвéѯǰ°Ñ´úÂëÀïµÄ‘YourMetaKey‘Ìæ»»³ÉÄãÐèÒªµÄÏàÓ¦Öµ¡£
ÒÔÏÂΪÒýÓõÄÄÚÈÝ£º DELETE FROM wp_postmeta WHERE meta_key = 'YourMetaKey'; |
ÍƼöÐÅÏ¢
- ¹¹½¨¸ß¿ÉÓú͵¯ÐÔÉìËõµÄKV´æ´¢ÏµÍ³
- ̸̸ÍøÕ¾¾²Ì¬»¯£¨¶þ£©
- ̸̸ÍøÕ¾¾²Ì¬»¯£¨Ò»£©
- Ðì¹úÏ飺΢²©ÊÇ·ñ»á²ÎÓëÍøÕ¾ÅÅÃû
- ApacheÔÚ±¾µØ½¨Á¢·ºÓòÃûÐéÄâÖ÷»ú¼ò·¨
- ÈçºÎ½øÐÐÍøÕ¾Õï¶Ï ΪÍøÕ¾½øÐÐÆÀ·Ö
- Ò»¸ö³É¹¦µÄÕ¾³¤Ó¦¸Ã¾ß±¸µÄËØÖÊ
- Ò»Ìõ΢²©Òý·¢µÄ·ÖÎö£ºÈçºÎÈÃ΢²©µÃµ½¹ã·º´«²¥
- ÈçºÎÈÃÒ»¸öÍøÕ¾ÓÐÇ¿´óÉúÃüÁ¦
- פ×ãIDCÃż÷³Ö±Ò¹ÛÍû Õ¾³¤Ñ¡¹º¿Õ¼ä³É¡°¼èÄѵľö¶¨¡±£¿
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
ÆÀÂÛ